![](/img/trans.png)
[英]aligning button to bottom within linearlayout parent with minheight
[英]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但是,我似乎仍然无法使页脚出现在布局的顶部。
任何建议表示赞赏:
<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>
您应该将layout_gravity:bottom
应用于LinearLayout,而不是DrawerLayout。 layout_
前缀可让孩子告诉父对象如何布置,放置等android:gravity
应该应用于父视图,并用于放置其所有子对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.