繁体   English   中英

将LinearLayout与DrawerLayout的底部对齐

[英]Aligning LinearLayout to the bottom of a DrawerLayout

我已经在应用程序的主要XML布局中实现了DrawerLayout,并且创建了一个页脚(基本上是水平[导航]栏),该页脚填充了屏幕的底部。 问题是-它不断出现在屏幕顶部...我尝试使用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

截图:

在此处输入图片说明

您应该将layout_gravity:bottom应用于LinearLayout,而不是DrawerLayout。 layout_前缀可让孩子告诉父对象如何布置,放置等android:gravity应该应用于父视图,并用于放置其所有子对象。

暂无
暂无

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

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