Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android音樂播放器之經典布局

Android音樂播放器之經典布局

編輯:關於Android編程

❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/bg1"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.42"
        android:background="@drawable/top_bg"
        android:gravity="center"
        android:text="@string/app_title"
        android:textSize="24sp" />

    <LinearLayout
        android:id="@+id/linearLayout3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1.45"
        android:gravity="bottom"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/lrc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/lrc_bg"
            android:gravity="center" />

        <TextView
            android:id="@+id/lrc1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textColor="@color/white"
            android:textSize="40pt" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.15"
        android:background="@drawable/bottom_bg"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
        
            android:gravity="center"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/textView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:padding="5dp"
                android:text="@string/time" />

            <SeekBar
                android:id="@+id/seekBar1"
                android:layout_width="fill_parent"
                android:layout_height="4dp"
                android:maxHeight="4dp"
                android:paddingBottom="0dp"
                android:paddingLeft="3dp"
                android:paddingRight="3dp"
                android:paddingTop="0dp"
                android:progressDrawable="@layout/seek_bar"
                android:thumb="@layout/thumb" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.18"
            android:gravity="center"
            android:orientation="horizontal" >

            <Button
                android:id="@+id/songlist"
                android:layout_width="42dp"
                android:layout_height="34dp"
                android:layout_marginRight="10dp"
                android:background="@drawable/list_button" />

            <Button
                android:id="@+id/pre"
                android:layout_width="41dp"
                android:layout_height="34dp"
                android:layout_gravity="center"
                android:layout_marginRight="10dp"
                android:background="@drawable/pre_button" />

            <Button
                android:id="@+id/mplay"
                android:layout_width="42dp"
                android:layout_height="34dp"
                android:layout_marginRight="10dp"
                android:background="@drawable/play_button" />

            <Button
                android:id="@+id/next"
                android:layout_width="40dp"
                android:layout_height="35dp"
                android:layout_marginRight="10dp"
                android:background="@drawable/next_button" />

            <Button
                android:id="@+id/update"
                android:layout_width="60dp"
                android:layout_height="40dp"
                android:background="@drawable/fresh" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

效果圖:

 

\

 

❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀onelist.xml

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <TextView
            android:id="@+id/songtitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="left"
            android:padding="10dp" android:layout_weight="10" android:textColor="@color/white"/>

        <TextView
            android:id="@+id/songtime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="right"
            android:padding="10dp" android:layout_weight="2" android:textColor="@color/white"/>

    </LinearLayout>


❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀seek_bar.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+android:id/background"
        android:drawable="@drawable/progressbar_bg"/>

    <item
        android:id="@+android:id/progress"
        android:drawable="@drawable/process_e_bg"/>

</layer-list>

❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀songlist.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg1" >

    <TextView
        android:id="@+id/totalcount"
        android:layout_width="fill_parent"
        android:layout_height="80dp"
        android:background="@drawable/top_bg"
        android:gravity="center"
        android:paddingBottom="8dp"
        android:paddingTop="8dp" />
      <TextView
        android:id="@+id/songtitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/totalcount"
        android:layout_alignParentLeft="true"
        android:gravity="left"
        android:padding="5dp"
        android:text="@string/music_text" />

    <LinearLayout
        android:id="@+id/linearLayout6"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@drawable/top_bg"
        android:gravity="center"
        android:paddingBottom="8dp"
        android:paddingTop="8dp" >

        <Button
            android:id="@+id/backmain"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/backmain" />

        <Button
            android:id="@+id/updatelist"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/listupdate" />

        <Button
            android:id="@+id/mode"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/mode" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout3"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/linearLayout6"
        android:layout_below="@+id/totalcount"
        android:orientation="vertical" >

        <!-- <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:background="@color/black"
            android:fadingEdgeLength="5dp"
            android:orientation="horizontal" >
        </LinearLayout> -->

        <ListView
            android:id="@+id/listView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/top_bg"
            android:divider="@color/white"
            android:fadingEdge="horizontal" >
        </ListView>

    </LinearLayout>

    <TextView
        android:id="@+id/songtime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/linearLayout3"
        android:layout_alignParentRight="true"
        android:gravity="right"
        android:padding="5dp"
        android:text="@string/time_text" />

</RelativeLayout>

效果圖:

 

\

❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀thumb.xml

<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
        <!-- 按下狀態 -->
        <item android:state_pressed="true" android:drawable="@drawable/click"/>
        <!-- 普通無焦點狀態 -->
        <item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/noclick" />
</selector>

 

❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀updatelist.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg1"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:ignore="UselessParent" >

        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="match_parent"
            android:layout_height="104dp"
            android:gravity="center" >

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/update" />

            <Button
                android:id="@+id/button2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="20dp"
                android:text="@string/backsonglist" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/linearLayout4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1.68"
            android:gravity="center"
            android:orientation="vertical"
            tools:ignore="InefficientWeight" >

            <ProgressBar
                android:id="@+id/progressBar1"
                style="?android:attr/progressBarStyleLarge"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:keepScreenOn="false"
                android:visibility="invisible" />

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="20sp" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/linearLayout3"
            android:layout_width="match_parent"
            android:layout_height="240dp"
            android:gravity="center"
            android:orientation="vertical" >
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

效果圖:\

❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀❀

 

 

 

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved