繁体   English   中英

像Google Play音乐中一样的Android持久音乐控制栏

[英]Android persistent music control bar like in Google Play Music

目前,我的应用程序中有一个带有四个不同选项卡的ViewPager。 我希望在底部添加一个小条来显示音乐控件,但是在选项卡之间滑动时我需要使其保持不变。 理想的功能是在诸如Google Play音乐之类的功能中,在不同标签之间滑动时,上拉面板位于底部。 我该怎么做?

AndroidSlidingUpPanel正是您所需要的,它是Umano开源的,因此您可以查看他们的应用程序以查看其工作方式。

编辑:

使用下面的代码进行的快速测试可提供所需的结果-底部的栏不会随着选项卡的更改而“滑动”:

<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom">
  <android.support.v4.view.ViewPager 
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="142dp"
    android:background="#CFCFCF">
    <TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="TEST"/>
  </LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

根据您在何处放置ViewPager,但可以在ViewPager的容器布局中放置SlidingUpPanelLayout。

例如,如果活动中有ViewPager,则可以将SlidingUpPanelLayout作为活动布局中的父级。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM