![](/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.