Android布局片段

时间:2015-05-30 17:44:04

标签: android layout footer

我不知道如何创建一个页脚,当页脚被拉起时,音乐播放器的选项会出现。我正在使用滑动标签布局。

2 个答案:

答案 0 :(得分:0)

考虑使用 - ViewDragHelper: 位于here的文档。

Here's之前有人问过类似的问题。

答案 1 :(得分:0)

您正在寻找的UI元素是DrawerLayout。您所要做的就是将它作为UI层次结构的顶级元素,添加视图,然后选择一个视图,以便在用户从窗口边缘滑动手指时显示。

开发人员网站上有一篇关于如何创建它的文章(here),这是他们的一个例子:

<android.support.v4.widget.DrawerLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <!-- The main content view -->
  <FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
  <!-- The navigation drawer -->
  <ListView android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:background="#111"/>
</android.support.v4.widget.DrawerLayout>

或者您可以使用SlidingDrawer来获得相同的结果,但请注意,在最新版本的Android中已弃用该类。