如何在底部导航视图中使用向上滑动面板?

时间:2018-10-24 07:21:00

标签: java android audio-player android-music-player

我正在使用this library向上滑动面板。我正在尝试将其与底部导航视图一起用于音乐流应用程序。我正在尝试做类似soundcloud的应用程序。但是我无法做到这一点,它显示出this的观点,我有两种观点,一种是迷你观点,另一种是大观点。我的Slideup面板的迷你播放器位于 底部导航视图。我希望它停留在底部导航视图的顶部。当我单击迷你播放器时,向上滑动面板会展开,迷你播放器不见了,大播放器可见了,底部导航也消失了。 对不起,我的英语不好。 这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".activity.MainActivity">


    <com.example.user.musicstreamingapp.CustomView.SlidingUpPanel.SlidingUpPanelLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:animateLayoutChanges="true"
        app:umanoPanelHeight="90dp"
        app:umanoShadowHeight="4dp"
        android:id="@+id/sliding_panel_layout"
        android:gravity="bottom"

        >
        <android.support.v4.view.ViewPager
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/view_pager"
            android:visibility="visible"

            />
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent">


         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:background="@color/bg"
             android:orientation="vertical"
             android:visibility="gone"
             android:id="@+id/music_player"
             >

             <android.support.v7.widget.CardView
                 android:id="@+id/mini_player"
                 android:layout_width="match_parent"
                 android:layout_height="80dp"
                 android:layout_alignParentBottom="true"
                 android:layout_marginLeft="8dp"
                 android:layout_marginRight="8dp"
                 android:visibility="visible"
                 app:cardBackgroundColor="@color/colorBlue"
                 app:cardUseCompatPadding="true">

                 <RelativeLayout
                     android:layout_width="match_parent"
                     android:layout_height="match_parent">

                     <com.example.user.musicstreamingapp.CustomView.CircularMusicProgressBar
                         android:id="@+id/music_round_progress"
                         android:layout_width="40dp"
                         android:layout_height="40dp"
                         android:layout_centerVertical="true"
                         android:layout_marginLeft="16dp"
                         android:src="@drawable/drake"
                         app:centercircle_diammterer="1"
                         app:draw_anticlockwise="false"
                         app:enable_touch="false"
                         app:progress_color="#FAC100"
                         app:progress_startAngle="40" />

                     <TextView
                         android:id="@+id/remain_time"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_marginLeft="12dp"
                         android:layout_marginTop="8dp"
                         android:layout_toRightOf="@id/music_round_progress"
                         android:text="1:22"
                         android:textColor="@color/wh"
                         android:textSize="12sp" />

                     <TextView
                         android:id="@+id/song_name_mini"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_centerVertical="true"
                         android:layout_marginLeft="12dp"
                         android:layout_toRightOf="@id/music_round_progress"
                         android:text="In My Feelings"
                         android:textColor="@color/wh"
                         android:textSize="16sp" />

                     <TextView
                         android:id="@+id/artist_name_mini"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_below="@+id/song_name_mini"
                         android:layout_marginLeft="12dp"
                         android:layout_toRightOf="@id/music_round_progress"
                         android:text="Drake"
                         android:textColor="#FAC100"
                         android:textSize="12sp" />

                     <ImageView
                         android:id="@+id/play_btn_mini"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_alignParentRight="true"
                         android:layout_centerVertical="true"
                         android:layout_marginRight="12dp"
                         android:src="@drawable/ic_play" />
                 </RelativeLayout>
             </android.support.v7.widget.CardView>

             <RelativeLayout
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:id="@+id/big_player"
                 >

                 <android.support.v7.widget.Toolbar
                     android:id="@+id/toolbar_top"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:background="@color/bg"
                     android:minHeight="?attr/actionBarSize"
                     app:theme="@style/CustomActionBar">

                     <RelativeLayout
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content">

                         <ImageView
                             android:id="@+id/arrow_down"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_alignParentLeft="true"
                             android:src="@drawable/ic_arrow_down" />

                         <TextView
                             android:id="@+id/toolbar_title"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_centerHorizontal="true"
                             android:layout_gravity="center"
                             android:fontFamily="sans-serif-medium"
                             android:text="@string/now_playing"
                             android:textColor="@color/grey"
                             android:textSize="18sp" />

                         <ImageView
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_alignParentRight="true"
                             android:layout_centerVertical="true"
                             android:paddingRight="8dp"
                             android:src="@drawable/ic_more" />
                     </RelativeLayout>


                 </android.support.v7.widget.Toolbar>

                 <RelativeLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_below="@id/toolbar_top"
                     android:layout_marginTop="12dp">

                     <com.example.user.musicstreamingapp.library.src.main.java.com.yarolegovich.discretescrollview.DiscreteScrollView
                         android:id="@+id/songs_thumb_rv"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_centerHorizontal="true"

                         />

                     <RelativeLayout
                         android:id="@+id/middle_view"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_below="@id/songs_thumb_rv"
                         android:layout_marginTop="20dp"
                         android:paddingLeft="16dp"
                         android:paddingRight="16dp">

                         <TextView
                             android:id="@+id/song_name"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"

                             android:layout_centerHorizontal="true"
                             android:text="Get Away"
                             android:textColor="@color/headerTextColor"
                             android:textSize="18sp" />

                         <TextView
                             android:id="@+id/artist_name"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_below="@id/song_name"
                             android:layout_centerHorizontal="true"
                             android:text="Drake"
                             android:textColor="@color/colorBlue"
                             android:textSize="12sp" />

                         <ImageView
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_alignParentLeft="true"
                             android:layout_centerVertical="true"
                             android:src="@drawable/ic_favorite_border"

                             />

                         <ImageView
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_alignParentRight="true"
                             android:layout_centerVertical="true"
                             android:src="@drawable/ic_download_border" />
                     </RelativeLayout>

                     <RelativeLayout
                         android:id="@+id/duration_view"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_below="@id/middle_view"
                         android:layout_marginLeft="16dp"
                         android:layout_marginRight="16dp"
                         android:layout_marginTop="12dp">

                         <TextView
                             android:id="@+id/current_time"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_alignParentLeft="true"
                             android:text="2.44"
                             android:textColor="@color/grey"
                             android:textSize="12sp" />

                         <SeekBar
                             android:id="@+id/seek_bar_music"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:layout_toLeftOf="@id/total_time"
                             android:layout_toRightOf="@id/current_time" />

                         <TextView
                             android:id="@+id/total_time"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_alignParentRight="true"
                             android:text="5.33" />
                     </RelativeLayout>

                     <RelativeLayout
                         android:id="@+id/player_view"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_below="@id/duration_view"
                         android:padding="30dp">

                         <ImageView
                             android:id="@+id/shuffle_btn"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_centerVertical="true"
                             android:src="@drawable/ic_shuffle" />

                         <ImageView
                             android:id="@+id/prev_btn"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_centerVertical="true"
                             android:layout_marginLeft="25dp"
                             android:layout_toRightOf="@id/shuffle_btn"
                             android:src="@drawable/ic_prev" />

                         <ImageView
                             android:id="@+id/play_btn_main"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_centerHorizontal="true"
                             android:src="@drawable/ic_play_new" />

                         <ImageView
                             android:id="@+id/next_btn"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_centerVertical="true"
                             android:layout_marginLeft="25dp"
                             android:layout_toLeftOf="@id/repeat_btn"
                             android:layout_toRightOf="@id/play_btn_main"
                             android:src="@drawable/ic_next" />

                         <ImageView
                             android:id="@+id/repeat_btn"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_alignParentRight="true"
                             android:layout_centerVertical="true"
                             android:src="@drawable/ic_repeat_all" />

                     </RelativeLayout>

                     <ImageView
                         android:id="@+id/video_available"
                         android:layout_width="wrap_content"

                         android:layout_height="wrap_content"
                         android:layout_below="@id/player_view"
                         android:layout_centerHorizontal="true"
                         android:src="@drawable/video_not_available" />

                     <LinearLayout
                         android:id="@+id/player_footer_menu"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_alignParentBottom="true"
                         android:orientation="horizontal"
                         android:paddingBottom="16dp"

                         >

                         <ImageView
                             android:id="@+id/settings_music"
                             android:layout_width="0dp"
                             android:layout_height="wrap_content"
                             android:layout_weight=".5"
                             android:src="@drawable/ic_settings" />

                         <ImageView
                             android:id="@+id/music_equalizer"
                             android:layout_width="0dp"
                             android:layout_height="wrap_content"
                             android:layout_weight="1"
                             android:src="@drawable/ic_equalizer" />

                         <ImageView
                             android:id="@+id/music_cast"
                             android:layout_width="0dp"
                             android:layout_height="wrap_content"
                             android:layout_weight="1"
                             android:src="@drawable/ic_cast" />

                         <ImageView
                             android:id="@+id/music_add_playlist"
                             android:layout_width="0dp"
                             android:layout_height="wrap_content"
                             android:layout_weight="1"
                             android:src="@drawable/ic_library_add" />

                         <ImageView
                             android:id="@+id/music_queue"
                             android:layout_width="0dp"
                             android:layout_height="wrap_content"
                             android:layout_weight=".5"
                             android:src="@drawable/ic_queue_music" />
                     </LinearLayout>

                 </RelativeLayout>

             </RelativeLayout>
         </LinearLayout>
     </RelativeLayout>
    </com.example.user.musicstreamingapp.CustomView.SlidingUpPanel.SlidingUpPanelLayout>

    <android.support.design.widget.BottomNavigationView
        android:layout_width="match_parent"
        android:layout_height="58dp"
        android:layout_gravity="bottom"
        android:id="@+id/bottom_nav_menu"

        android:background="@android:color/white"
        android:layout_alignParentBottom="true"
        app:itemBackground="@color/wh"
        app:itemIconTint="@color/tab_foreground"
        app:itemTextColor="@color/tab_foreground"
        app:menu="@menu/bottom_nav_menu"/>



</RelativeLayout>`

0 个答案:

没有答案