如何将底栏添加到slidePaneLayout

时间:2014-05-25 16:12:21

标签: android

如何将底栏添加到slidePaneLayout?。

你能帮我解决这个问题,

我需要一个 height = 50dp width = fill_parent 的底栏。其中包含3个小按钮/图标。

SlidePaneLayout

的底部

1 个答案:

答案 0 :(得分:0)

SlidingPaneLayout 放在 RelativeLayout 中,然后在 SlidingPaneLayout 之后添加合适的底栏 RelativeLayout / p>

然后指定以下属性

android:layout_centerHorizontal="true"
android:layout_alignParentBottom = "true"
android:layout_width="match_parent"
android:layout_height="50dp"

下面粘贴完整的 xml代码以供参考。

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

    <android.support.v4.widget.SlidingPaneLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/slidingpanelayout">

    <RelativeLayout android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="#8B8989"
              android:orientation="horizontal"
              android:id="@+id/fragment_leftpane">
    </RelativeLayout>
    <RelativeLayout android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="#99CC32"
              android:layout_marginLeft="40dp"
              android:orientation="horizontal"
              android:id="@+id/fragment_rightpane">
    </RelativeLayout>
    </android.support.v4.widget.SlidingPaneLayout>


    <RelativeLayout
            android:id="@+id/bottomBar"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom = "true"
            android:background="#FFF"
            android:orientation="horizontal"
            android:text="BottomBar" >

    </RelativeLayout>
</RelativeLayout>