android音乐播放器的设计与实现毕业设计论文(编辑修改稿)内容摘要:

d/ibtn_player_voice android:layout_toRightOf=@id/ibtn_player_list 13 android:ellipsize=marquee android:focusable=true android:focusableInTouchMode=true android:gravity=center_horizontal android:lines=1 android:marqueeRepeatLimit=marquee_forever android:singleLine=true android:text=显示歌名 android:textColor=@android:color/white android:textSize=19sp android:textStyle=bold / TextView android:id=@+id/tv_player_singer_info android:layout_width=fill_parent android:layout_height=wrap_content android:layout_below=@id/tv_player_song_info android:layout_centerHorizontal=true android:layout_toLeftOf=@+id/ibtn_player_voice android:layout_toRightOf=@id/ibtn_player_list android:ellipsize=marquee android:focusable=true android:focusableInTouchMode=true android:marqueeRepeatLimit=marquee_forever android:paddingLeft=71dip android:singleLine=true android:text=显示歌手 android:textColor=@android:color/white android:textSize=15sp / ImageButton android:id=@+id/ibtn_player_voice android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentRight=true android:background=@drawable/player_btn_voice / /RelativeLayout 1. 播放音轨 SeekBar 在 , SeekBar的代码如下: SeekBar android:id=@+id/sb_player_voice android:layout_width=fill_parent android:layout_height=wrap_content 14 android:layout_centerVertical=true android:layout_toLeftOf=@id/iv_player_max_voice android:layout_toRightOf=@id/iv_player_min_voice android:background=@drawable/voice_seekbar_bg android:paddingLeft=5dp android:paddingRight=5dp android:progressDrawable=@drawable/voice_seekbar_progress android:thumb=@drawable/voice_seekbar_thumb / 上面代码中有参数 android: thumb=@drawable/ voice_seekbar_thumb为音轨游标的图片资源 android: progressDrawable=@drawable/ voice_seekbar_progress 为 SeekBar条的风格 style。 引用了 drawable中的 , ,代码如下: ?xml version= encoding=utf8? layerlist xmlns:android= item android:id=@android:id/background android:drawable=@drawable/voice_seekbar_bg /item item android:id=@android:id/progress clip android:drawable=@drawable/voice_seekbar_one / /item /layerlist 播放器最重要的一部分就是音轨与歌曲进度同步的实现。 音轨设置了两个 TextView用来显示当前歌曲播放的进度时间和歌曲的长度 (图 )。 图 播放音轨 音轨对象 SeekBar部分代码如下: private void ShowSeekBar() { (new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } 15 @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { seekbar_change(progress)。 }else if (() == ) { // 设置音量 (, progress, 0)。 } } })。 } /** * 进度条改变事件 */ private void seekbar_change(int progress) { Intent intent = new Intent()。 ()。 (op, PROGRESS_CHANGE)。 (progress, progress)。 startService(intent)。 } 2. 播放 调节 功能实现 各按钮水平放置,从左到右依次是上一首、播放、下一首功能按钮。 用的是布局中的线性布局 LinearLayout,。 将其设置为水平,如图 : 图 播放功能按钮 LinearLayout中依次放置播放 /暂停,上一首、下一首按钮属性。 配置文件代码 结构如下: LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:layout_centerVertical=true android:layout_toLeftOf=@id/ibtn_player_control_mode android:layout_toRightOf=@id/ibtn_player_control_menu android:gravity=center 16 android:orientation=horizontal ImageButton android:id=@+id/ibtn_player_control_pre android:layout_width=75dip android:layout_height=58dip android:background=@drawable/player_btn_player_pre/ ImageButton android:id=@+id/ibtn_player_control_play android:layout_width=75dip android:layout_height=58dip android:background=00000000 / ImageButton android:id=@+id/ibtn_player_control_ne。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。