Android Studio 学习(三)

Android Studio 学习(三)

服务与广播

学习目标:

1、掌握服务的基本概念,能编写服务过程并进行调用;
2、掌握广播的基本概念,能实现广播通信。
3、需实现的具体功能为:
短信到来时自动产生的系统广播→激活音乐播放服务程序→活动组件程序使得停止按钮可用。

项目功能说明:

1、音乐播放界面能显示歌曲封面、歌曲名、作者、播放进度、当前时间、歌曲总时间
2、能实现上一首、下一首、暂停、播放、停止,并且封面随之改变
3、拖动进度条可以对应的改变歌曲的播放进度
4、页面布局清晰,运行流畅

核心代码:

音乐播放页面由基本信息界面、控制界面两个界面组成,分别对应两个LinearLayout
基本信息界面包含一个ImageView(歌曲封面)、两个LinearLayout
基本信息界面中的第一个LinearLayout中有两个TextView分别对应歌曲名、作者
基本信息界面中的第二个LinearLayout中包含两个TextView和一个SeeBar分别对应当前时间、歌曲总时间、进度条
控制界面包含四个ImageButton分别对应上一首、播放(暂停)、停止、下一首

基本信息界面:歌曲名、作者

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="#ffffff"
                android:text="Title"
                android:textSize="20dp" />

            <TextView
                android:id="@+id/author"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="#ffffff"
                android:text="Author"
                android:textSize="20dp" />
        </LinearLayout>

基本信息界面:当前时间、进度条、歌曲总时间

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/curTime"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:background="#ffffff"
                android:text="00:00" />

            <SeekBar
                android:id="@+id/seekBar"
                android:layout_width="310dp"
                android:layout_height="wrap_content"
                android:background="#ffffff"
      
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值