没有合适的资源?快使用搜索试试~ 我知道了~
播放器源码,开始拖动进度条时,音乐暂停播放,当进度条的值改变时,音乐播放器从新的位置开始播放
资源推荐
资源详情
资源评论
/*变量声明*/
02
private ImageButton playBtn = null;//播放、暂停
03
private ImageButton latestBtn = null;//上一首
04
private ImageButton nextButton = null;//下一首
05
private ImageButton forwardBtn = null;//快进
06
private ImageButton rewindBtn = null;//快退
07
private TextView playtime = null;//已播放时间
08
private TextView durationTime = null;//歌曲时间
09
private SeekBar seekbar = null;//歌曲进度
10
private Handler handler = null;//用于进度条
11
private Handler fHandler = null;//用于快进
12
private int currentPosition;//当前播放位置
[代码] 获得上一个activity传来的数据
01
@Override
02
protected void onCreate(Bundle savedInstanceState) {
03
super.onCreate(savedInstanceState);
02
private ImageButton playBtn = null;//播放、暂停
03
private ImageButton latestBtn = null;//上一首
04
private ImageButton nextButton = null;//下一首
05
private ImageButton forwardBtn = null;//快进
06
private ImageButton rewindBtn = null;//快退
07
private TextView playtime = null;//已播放时间
08
private TextView durationTime = null;//歌曲时间
09
private SeekBar seekbar = null;//歌曲进度
10
private Handler handler = null;//用于进度条
11
private Handler fHandler = null;//用于快进
12
private int currentPosition;//当前播放位置
[代码] 获得上一个activity传来的数据
01
@Override
02
protected void onCreate(Bundle savedInstanceState) {
03
super.onCreate(savedInstanceState);
04
setContentView(R.layout.play);
05
Intent intent = this.getIntent();
06
Bundle bundle = intent.getExtras();
07
_ids = bundle.getIntArray("_ids"); //获得保存音乐文件_ID的数组
08
position = bundle.getInt("position"); //获得应该播放的音乐的号数,既播放第几首
09
//代码未完,见下面的代码
10
}
[代码] 初始化控件
1
playtime = (TextView)findViewById(R.id.playtime); //显示已经播放的时间
2
durationTime = (TextView)findViewById(R.id.duration); //显示歌曲总时间
3
playBtn = (ImageButton)findViewById(R.id.playBtn); //开始播放、暂停播放按钮
4
latestBtn = (ImageButton)findViewById(R.id.latestBtn); //播放上一首按钮
5
nextButton = (ImageButton)findViewById(R.id.nextBtn); //播放下一首按钮
6
forwardBtn = (ImageButton)findViewById(R.id.forwardBtn); //快进按钮
7
rewindBtn = (ImageButton)findViewById(R.id.rewindBtn); //快退按钮
8
setContentView(R.layout.play);
05
Intent intent = this.getIntent();
06
Bundle bundle = intent.getExtras();
07
_ids = bundle.getIntArray("_ids"); //获得保存音乐文件_ID的数组
08
position = bundle.getInt("position"); //获得应该播放的音乐的号数,既播放第几首
09
//代码未完,见下面的代码
10
}
[代码] 初始化控件
1
playtime = (TextView)findViewById(R.id.playtime); //显示已经播放的时间
2
durationTime = (TextView)findViewById(R.id.duration); //显示歌曲总时间
3
playBtn = (ImageButton)findViewById(R.id.playBtn); //开始播放、暂停播放按钮
4
latestBtn = (ImageButton)findViewById(R.id.latestBtn); //播放上一首按钮
5
nextButton = (ImageButton)findViewById(R.id.nextBtn); //播放下一首按钮
6
forwardBtn = (ImageButton)findViewById(R.id.forwardBtn); //快进按钮
7
rewindBtn = (ImageButton)findViewById(R.id.rewindBtn); //快退按钮
8
剩余8页未读,继续阅读
资源评论
xzh1232002
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- apk.tw_LineLite_v8a_v.2.17.1_sign.apk
- Elasticsearch实战:构建高效搜索系统的秘诀.zip
- HTML+CSS+JS网页设计:从入门到精通.zip
- 数据库课程设计:从理论到实践的全面指南.zip
- Python闭包:深入理解与应用场景解析.zip
- Win64OpenSSL-3-3-0.exe
- 课高分程设计-基于C++实现的民航飞行与地图简易管理系统-南京航空航天大学
- 航天器遥测数据故障检测系统python源码+文档说明+数据库(课程设计)
- 北京航空航天大学操作系统课设+ppt+实验报告
- 基于Vue+Echarts实现风力发电机中传感器的数据展示监控可视化系统+源代码+文档说明(高分课程设计)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功