音乐应用开发Android应用开发--MP3音乐播放器界面设计(2)
在寫這篇文章之前,xxx已寫過了幾篇關于改音樂應用開發主題的文章,想要了解的朋友可以去翻一下之前的文章
????Android應用開發--MP3音樂播放器界面計劃(2)
????2013年5月25日 簡、美音樂播放器開發
????真得很無奈,本來盤算很快結束這個實戰項目的,但因為各種滿課、學科、瑣事給耽誤了進度,現在小巫的這個簡、美音樂播放器基本上已開發出來了個原型,以后會繼承在這個原型基礎上添加各種功能。這篇博文繼承按照UI先搭建好,再實現業務邏輯。
????這里有一點說明一下,關于歌詞的滾動表現,小巫還沒完整實現,須要去參考一下別人的實現方法,所以布局不太肯定,暫時用TextView控件代替,前面可能須要自定義TextView來實現歌詞表現的功能,所以這是這個UI須要注意的。
????效果圖:
????? ??? ? ? ?
????
????
????以上第一個UI是主界面的,稍微美化了一下
????列表布局music_list_item_layout.xml
????
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/RelativeLayout1"android:layout_width="match_parent"android:layout_height="50.0dp"android:orientation="vertical" ><ImageViewandroid:id="@+id/albumImage"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentLeft="true"android:layout_alignParentTop="true"android:src="@drawable/item" /><TextViewandroid:id="@+id/music_duration"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_alignParentTop="true"android:layout_marginRight="5.0dp"android:textColor="@android:color/white"android:text="@string/time" /><TextViewandroid:id="@+id/music_title"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentTop="true"android:layout_marginLeft="5dp"android:layout_toRightOf="@+id/albumImage"android:textColor="@android:color/white"android:text="@string/siger" /><TextViewandroid:id="@+id/music_Artist"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignLeft="@+id/music_title"android:layout_below="@id/music_title"android:textColor="@android:color/white"android:text="@string/artist" /></RelativeLayout>????第二個是用來表現歌詞和控制播放的UI,是這篇博文要實現的。
????布局代碼如下:
????
每日一道理如果只看到太陽的黑點,那你的生活將缺少溫暖;如果你只看到月亮的陰影,那么你的生命歷程將難以找到光明;如果你總是發現朋友的缺點,你么你的人生旅程將難以找到知音;同樣,如果你總希望自己完美無缺,假設你的這一愿望真的能如愿以償,那么你最大的缺點就是沒有缺點。
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/RelativeLayout1"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/bg_playback" ><RelativeLayoutandroid:id="@+id/header_layout"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentTop="true" ><Buttonandroid:id="@id/repeat_music"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentLeft="true"android:background="@drawable/repeat_none_selector" /><Buttonandroid:id="@id/shuffle_music"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:background="@drawable/shuffle_none_selector" /><TextViewandroid:id="@+id/musicTitle"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignBaseline="@id/repeat_music"android:layout_centerHorizontal="true"android:text="@string/siger"android:textAppearance="?android:attr/textAppearanceLarge" android:ellipsize="marquee"android:focusable="true"android:focusableInTouchMode="true"android:gravity="center_horizontal"android:lines="1"android:marqueeRepeatLimit="marquee_forever"android:textColor="@android:color/white"android:singleLine="true"/><TextView android:id="@+id/musicArtist"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@id/musicTitle"android:layout_marginTop="15dp"android:layout_centerHorizontal="true"android:textSize="18sp"android:textColor="#0F0"android:text="@string/artist"/></RelativeLayout><ScrollViewandroid:id="@+id/lrcScrollView"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_below="@id/header_layout" ><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:text="好歌不容錯過"android:textAppearance="?android:attr/textAppearanceLarge" /></ScrollView><RelativeLayoutandroid:id="@+id/footer_layout"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true" ><RelativeLayoutandroid:id="@+id/seekbarLayout"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@id/lrcScrollView"android:background="@drawable/player_progresslayout_bg" ><SeekBarandroid:id="@+id/audioTrack"android:layout_width="match_parent"android:layout_height="wrap_content" android:layout_centerVertical="true"android:background="@drawable/player_progress_bg"android:progressDrawable="@drawable/seekbar_img"android:thumb="@drawable/media_player_progress_button"/><TextViewandroid:id="@+id/current_progress"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@id/audioTrack"android:text="0:25" /><TextViewandroid:id="@+id/final_progress"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_below="@id/audioTrack"android:text="3:59" /></RelativeLayout><RelativeLayoutandroid:id="@+id/relativeLayout2"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@+id/seekbarLayout" ><Buttonandroid:id="@id/play_music"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_above="@+id/relativeLayout2"android:layout_centerHorizontal="true"android:background="@drawable/pause_selector" /><Buttonandroid:id="@id/next_music"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignBaseline="@+id/play_music"android:layout_toRightOf="@+id/play_music"android:background="@drawable/next_music_selector" /><Buttonandroid:id="@id/previous_music"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignBaseline="@+id/play_music"android:layout_toLeftOf="@+id/play_music"android:background="@drawable/previous_music_selector" /><Buttonandroid:id="@+id/play_queue"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignBaseline="@+id/next_music"android:layout_toRightOf="@+id/next_music"android:background="@drawable/play_queue_selector" /><Buttonandroid:id="@+id/search_music"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignBaseline="@+id/previous_music"android:layout_toLeftOf="@+id/previous_music"android:background="@drawable/search_selector" /></RelativeLayout></RelativeLayout></RelativeLayout>
????
????關于簡、美音樂播放器是小巫本人自行計劃的,是我想實現的效果,只是給個參考罷了,童鞋們自己可以按照自己的想法來布局,計劃出更加美觀好看的界面,小巫在這個方面是有些完善的。由于整個項目還處于開發狀態,暫時不會共享項目源代碼,直到把這個播放器開發到比較完善的時候才會上傳資源,小巫也會把代碼貼在每一篇博文上,須要的可以參考一下。
????
????
文章結束給大家分享下程序員的一些笑話語錄: 程序語言綜述
CLIPPER 程序員不去真的獵捕大象,他們只是購買大象部分的庫然后花幾年的時間試圖綜合它們。
DBASE 程序員只在夜間獵捕大象,因為那時沒人會注意到他們還在使用石弓。
FOXPRO 程序員開始使用更新更好的步槍,這使他們花掉比實際狩獵更多的時間學習新的射擊技術。
C 程序員拒絕直接購買步槍,寧可帶著鋼管和一個移動式機器車間到非洲,意欲從零開始造一枝完美的步槍。
PARADOX 程序員去非洲時帶著好萊塢關于獵捕大象的電影劇本,他們認為照劇本行事就會逮到一頭大象。
ACCESS 程序員在沒有任何獵象經驗的經驗下就出發了,他們穿著華麗的獵裝、帶著全部裝備,用漂亮的望遠鏡找到了大象,然后發覺忘了帶扳機。
RBASE 程序員比大象還要稀少,事實上,如果一頭大象看到了一個RBASE程序員,對他是個幸運日。
VISUAL ACCESS 程序員裝上子彈、舉起步槍、瞄準大象,這使大象感到可笑,究竟誰逃跑。他們無法抓住大象,因為由于他們對多重控制的偏愛,他們的吉普車有太多的方向盤因而無法駕駛。
ADA、APL和FORTRAN 程序員與圣誕老人和仙女一樣是虛構的。
COBOL 程序員對和自己一樣瀕臨滅絕的大象寄予了深切的同情。
--------------------------------- 原創文章 By
音樂和應用開發
---------------------------------
總結
以上是生活随笔為你收集整理的音乐应用开发Android应用开发--MP3音乐播放器界面设计(2)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电脑mp4视频怎么显示缩略图 电脑上MP
- 下一篇: 大数的菲波那契计算/Huge Fibon