Android 音乐播放器的开发教程(三) 小卷毛播放器的主界面开发
拿好素材之后,打开你们的开发工具,小达这里用的是android studio1.0, 新建一个项目,打开activity_main.xml文件,布局文件如下
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_gravity="center_horizontal"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="@drawable/bg_photo_01">
<LinearLayout
android:id="@+id/fragment_layout"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</LinearLayout>
<SeekBar
android:id="@+id/process_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/bottom_layout"
android:progressDrawable="@drawable/progress_holo_light"
android:thumb="@drawable/detail_icon_schedule_ball"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:id="@+id/bottom_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#20000000"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:onClick="main_activity_bottom_layout_listener">
<TextView
android:id="@+id/music_info_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:textColor="@color/mediumorchid"
android:ellipsize="marquee"
android:text="@string/hello_world"/>
<TextView
android:id="@+id/singer_info_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:padding="5dp"
android:textColor="@color/mediumorchid"
android:layout_below="@id/music_info_textView"
android:text="@string/hello_world"/>
<ImageButton
android:id="@+id/next_song_button"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="@drawable/next_music_photo"/>
<ImageButton
android:id="@+id/play_button"
android:layout_toLeftOf="@id/next_song_button"
android:layout_toStartOf="@id/next_song_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#00ffffff"/>
<ImageButton
android:id="@+id/previous_song_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/play_button"
android:layout_toStartOf="@id/play_button"
android:layout_centerVertical="true"
android:background="@drawable/previous_music_photo"/>
<ImageButton
android:id="@+id/play_mode_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/previous_song_button"
android:layout_toStartOf="@id/previous_song_button"
android:background="#00000000"
android:layout_centerVertical="true"/>
</RelativeLayout>
</RelativeLayout>