2012-11-14 85 views
0

我工作的音樂播放應用程序自定義通知欄,我想顯示主屏幕,XYZ的音樂播放(彈出notifucation條如Spotify)的通知。如何實現音樂在屏幕上

我怎樣才能顯示在播放列表的末尾這樣的彈出通知欄?當音樂正在播放時,當用戶點擊該欄時,它將重定向到音樂播放屏幕。

當沒有音樂播放時酒吧裏拿自動隱藏,也想隱藏在動畫那個酒吧,我怎麼能在底部

顯示它在列表視圖作爲一個例子,請看看下面 enter image description here

回答

2

使用權力,盧克。的RelativeLayout功率:

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <ListView 
      android:id="@+id/playlist" 
      android:layout_above="@+id/notification" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"/> 

    <RelativeLayout 
      android:id="@+id/notification" 
      android:layout_alignParentBottom="true" 
      android:layout_height="wrap_content" 
      android:layout_width="match_parent"> 

      <ImageView 
        android:id="@+id/imgview_album_art" 
        android:src="image" 
        android:layout_centerVertical="true" 
        android:layout_alignParentLeft="true" 
        android:layout_width="48dp" 
        android:layout_height="48dp"/> 

      <LinearLayout 
        android:orientation="vertical" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_centerVertical="true" 
        android:layout_toLeftOf="@+id/btn_play_pause" 
        android:layout_toRightOf="@+id/imgview_album_art"> 

       <TextView 
         android:text="Paradise" 
         android:id="@+id/textview_song_name" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"/> 

       <TextView 
         android:text="Coldplay - Mylo Xyloto" 
         android:id="@+id/textview_artist_album" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"/> 

      </LinearLayout> 

      <ImageButton 
        android:id="@+id/btn_play_pause" 
        android:padding="8dp" 
        android:background="@android:color/transparent" 
        android:src="@android:drawable/ic_media_pause" 
        android:layout_centerVertical="true" 
        android:layout_alignParentRight="true" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"/> 


    </RelativeLayout> 

</RelativeLayout> 
相關問題