Android开发----音乐播放器(界面设计)

来源:互联网 发布:mac邮件设置qq邮箱 编辑:程序博客网 时间:2024/04/30 19:39

   转眼也沦为“大四狗”的行列当中去,本来打算在暑假的时候找一个实习,结果学校临时安排了“暑期实训”大哭大哭大哭

   原本计划好的安排全部被打乱了,哎~~~也只能跟着学校的脚步“摩擦摩擦”了哭

   暑期实训我选择的Android开发,当时选他的初衷很简单:

   1.看内容安排的时候,是安排写一个游戏引擎以及文档的书写规范,看着内容很高大上的感觉...有木有?!?!?!(后来真正开始上课的时候,只能呵呵....)

   2.之前没有接触过Android开发,能接触一门新的语言也是不错的微笑

   3.据说培训的师兄是个帅哥,完全犯花痴,不要拉我...我要为他献上我的膝盖羡慕

OK~~口水擦擦,还是说正题吧。

   暑期实训的内容主要是开发一款类似于时下主流的音乐播放器,很类似于天天动听、酷狗音乐之类的,在此也很感谢某位博主提供的素材,让我可以不用反解压QQ音乐微笑,先上图,再来详细介绍我的音乐播放器的实现过程


 先说实现的功能有哪些:

1.上一曲/下一曲

2.顺序循环(初始化的播放次序)

3.随机播放(代码还是有些问题,获取到了随机数,但播放的时候老是卡顿,这个后面再说)

4.单曲循环

5.播放/暂停

6.当前播放进度

7.歌曲总时长

8.快进/快退(拖动进度条的效果)

9.同步显示歌词

10.页面布局(布局什么的还真是....关乎一个人的审美能力呀)

先说最基础也是最重要的-------页面布局

采用RelativeLayout布局,这里先说明一下RelativeLayout和LinearLayout的区别

RelativeLayout是相对布局,在页面上相对于页面坐标进行布局设置。

比如可以通过确定对象A确定对象B的位置,

B可以在A的上下左右,

对象B距离A的位置。

灵活性很高,但很难确定定位对象的位置。

LinearLayout是线性布局,在使用LinearLayout 的时候,思路大致是将页面母板分成若干部分android:orientation="vertical"将各个部分垂直分布

android:orientation="horizontal"实现各个对象的横向分布

相对性比较强,利于划分块

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/RelativeLayout1"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="@drawable/bg_playback" >    <RelativeLayout        android:id="@+id/handle_btnlayout"        android:layout_width="match_parent"        android:layout_height="wrap_content" >        <ImageView            android:id="@+id/previous_music"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignParentLeft="true"            android:layout_marginLeft="10dp"            android:background="@drawable/previous_music_selector" />        <ImageView            android:id="@+id/repeat_music"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_toRightOf="@id/previous_music"            android:layout_marginLeft="10dp"            android:background="@drawable/repeat_none_selector" />        <ImageView            android:id="@+id/play_music"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_toRightOf="@id/repeat_music"            android:layout_marginLeft="25dp"            android:background="@drawable/play_selector" />        <ImageView            android:id="@+id/shuffle_music"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_toRightOf="@id/play_music"            android:layout_marginLeft="25dp"            android:background="@drawable/shuffle_none_selector" />        <ImageView            android:id="@+id/next_music"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignParentRight="true"            android:layout_marginRight="10dp"            android:background="@drawable/next_music_selector" />    </RelativeLayout>        <ListView        android:id="@+id/music_list"        android:layout_width="match_parent"        android:layout_height="wrap_content"       android:layout_below="@id/handle_btnlayout"        android:layout_marginBottom="50dp" />         <RelativeLayout        android:id="@+id/singleSong_layout"        android:layout_width="match_parent"        android:layout_height="50dp"        android:layout_alignParentBottom="true" >             <TextView                android:id="@+id/stop_time"                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_alignParentRight="true"                android:layout_marginLeft="10dp"                android:layout_marginRight="15dp"                android:layout_marginTop="16dp"                android:text="00:00"                android:textColor="#FFFFFF" />        <TextView                android:id="@+id/start_time"                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_marginLeft="15dp"                android:layout_marginTop="16dp"                android:text="00:00"                android:textColor="#FFFFFF" />        <SeekBar                android:id="@+id/bar_time"                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:layout_centerVertical="true"                android:layout_marginLeft="10dp"                android:layout_marginRight="10dp"                android:layout_toLeftOf="@id/stop_time"                android:layout_toRightOf="@id/start_time"                android:progress="0" />                 </RelativeLayout>          <TextView        android:id="@+id/text_gc"        android:layout_width="wrap_content"        android:layout_height="wrap_content"       android:layout_above="@id/singleSong_layout"       android:layout_centerInParent="true"       android:textColor="#A6FFFF"       android:text="none"        /></RelativeLayout>
这里就实现了布局,下一篇再介绍具体功能的实现,See you

 

0 0
原创粉丝点击