【达内课程】音乐播放器3.0(上)

开发步骤

【1】显示软件界面
  1)设计布局:包括 activity_main.xml 和 ListView 的模板
    a)先设计底部按钮区域
    b)设计中间歌曲信息显示区域
    c)添加ListView控件
  2)读取数据(完成 MusicDao 相关类)
    a)先设计实体类 Music
    b)设计 IDao 接口
    c)创建 MusicDao 实现 IDao 接口,并重写抽象方法
    d)创建 MusicDaoFactory,提供静态方法返回 MusicDao 的对象
  3)实现 Adapter(完成 MusicAdapter 相关类)
  4)显示 ListView
【2】开发 Service
  1)创建并注册 Service
  2)在 Service 内部完成播放控制相关方法,例如 play() 等
【3】实现基本控制
【4】实现播放信息显示
【5】实现细节,修复 bug

展示音乐列表

布局文件

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ListView
        android:id="@+id/lv_music_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/ll_music_info" />

    <LinearLayout
        android:id="@+id/ll_music_info"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/sk_progress"
        android:padding="10dp">

        <TextView
            android:id="@+id/tv_music_info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="请选择播放歌曲" />

    </LinearLayout>

    <SeekBar
        android:id="@+id/sk_progress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/ll_button_layout" />

    <LinearLayout
        android:id="@+id/ll_button_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="center">

        <ImageButton
            android:id="@+id/ib_previous"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_media_previous" />

        <ImageButton
            android:id="@+id/ib_play"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_media_play" />

        <ImageButton
            android:id="@+id/ib_next"
            android:layout_width="wrap_content"
            android:layout_height
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值