Android开发:服务与多线程--简单音乐播放器

实验内容: 1. 播放、暂停、停止、退出功能 2. 后台播放功能 3. 进度条显示播放进度、拖动进度条改变进度功能 4. 播放时图片旋转,显示当前播放时间功能
摘要由CSDN通过智能技术生成

实验内容:
1. 播放、暂停、停止、退出功能
2. 后台播放功能
3. 进度条显示播放进度、拖动进度条改变进度功能
4. 播放时图片旋转,显示当前播放时间功能

一. 参考网站

https://zhidao.baidu.com/question/1770591672437913940.html android开发 mp3文件放在哪个文件夹

http://blog.csdn.net/kjunchen/article/details/50429694 Android应用开发按下返回键退向后台运行

http://www.cnblogs.com/menlsh/archive/2013/06/07/3125341.html Android使用Handler实时更新UI

http://blog.csdn.net/hahawhyha/article/details/12783643 Error: start called in state 64

http://www.oschina.net/question/54100_32914 Android MediaPlayer 播放prepareAsync called in state 8解决办法

http://stackoverflow.com/questions/17054000/cannot-resolve-symbol-r-in-android-studio “cannot resolve symbol R” in Android Studio

二. 实验步骤

  1. 实现播放器主页面。主要控件有ImageView, TextView, SeekBar和Button。实现思路是整体页面是一个RelativeLayout, 音乐背景图ImageView和显示文件路径和当前状态的TextView是RelativeLayout下的控件。

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/cover"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="25dp"
        android:scaleType="center"/>
    
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/path"
        android:textColor="@color/colorBlack"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="300dp" />
    
    <TextView
        android:id="@+id/state"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/initial"
        android:layout_marginTop="320dp"
        android:layout_marginLeft="10dp"
        android:textSize="20sp"
        android:textColor="@color/colorBlack"/>    

    拖动条SeekBar和两边显示时间的TextView放在主布局下的一个LinearLayout里面

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="360dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:orientation="horizontal"
        android:gravity="center_vertical">
    
        <TextView
            android:id="@+id/currentTime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/begin"
            android:textColor="@color/colorBlack"/>
    
        <SeekBar
            android:id="@+id/seekBar"
            android:layout_width="0dp"
            android:layout_height=
  • 5
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值