安卓实训项目:音乐播放器3.0——实训报告3

一、功能要求
在基于存储卡音乐播放器V0.2基础上,增加功能:

添加一个音乐播放列表(显示歌名)
– 单击某一首音乐就立刻播放,播放进度清零,显示当前音乐的播放时长。
添加一个【上一首】与【下一首】按钮----完成
– 当前音乐为第一首时,单击【上一首】按钮,切换到最后一首音乐。----完成
– 当前音乐为最后一首时,单击【下一首】按钮,切换到第一首音乐。----完成
– 当某一首音乐播放完毕后,会自动切换到下一首音乐播放。----完成

二、运行效果
在这里插入图片描述
实现步骤
将图片素材拷贝到drawable目录与mipmap目录
在这里插入图片描述
上一首按钮背景图片选择器 - previous_button_selector.xml
在这里插入图片描述
下一首按钮背景图片选择器 - next_button_selector.xml
在这里插入图片描述
主布局资源文件activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background"
    android:orientation="vertical"
    android:padding="20dp"
    tools:context=".ui.MainActivity">

    <ListView
        android:id="@+id/lvMusicName"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginBottom="16dp"
        android:layout_weight="8" />

    <TextView
        android:id="@+id/tvMusicName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:textColor="#0000ff"
        android:textSize="20sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="10dp"
        android:layout_weight="0.5"
        android:gravity="center"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/tvCurrentPosition"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:textColor="#ff0000" />

        <ProgressBar
            android:id="@+id/pbMusicProgress"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_widt
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值