2

我已经在我的应用程序的主要 XML 布局中实现了一个 DrawerLayout - 我已经创建了一个填充屏幕底部的页脚(基本上是一个水平的 [navigation-ish] 栏)。问题是 - 它不断出现在屏幕顶部......我尝试使用android:layout_gravity="bottom",android:layout_weight="1.0"android:baselineAligned="false"在此处记录: http: //sandipchitale.blogspot.com/2010/05/linearlayout-gravity-and-layoutgravity。 html但是,我似乎仍然无法让页脚出现在布局的顶部。

任何建议表示赞赏:

XML 片段:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="bottom"
    android:background="@color/black"
    android:baselineAligned="false" >



    ...



        <LinearLayout
        android:id="@+id/footer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1.0"
        android:orientation="horizontal" >
    </LinearLayout>

</android.support.v4.widget.DrawerLayout>

完整的 XML 源:

http://pastebin.com/67cHtwJ1

截屏:

在此处输入图像描述

4

1 回答 1

6

您应该申请layout_gravity:bottomLinearLayout,而不是 DrawerLayout。前缀让子级告诉父级它layout_希望如何布局、定位等android:gravity应该应用于父级视图,并用于定位其所有子级。

于 2015-09-29T19:37:24.767 回答