我在我的活動中使用了LinearLayout,因爲我需要顯示另一個包含要顯示在底部的圖像的LinearLayout。Android:如何在佈局的底部放置一個顯示圖像的線性佈局?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/gamelevelscreen"
android:orientation="vertical" >
.......
<LinearLayout
android:id="@+id/linearLayout_AdMob"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:gravity="center">
</LinearLayout>
</LinearLayout>
但是圖像並沒有完全對齊在底部。它略高於底部。 我已經完成了佈局設計,現在將進行大量的返工。請給出解決方案,使其僅在LinearLayout中發生。
'機器人:layout_alignParentBottom = 「真」'在'LinearLayout'沒有影響。考慮使用'RelativeLayout'來代替。 –
@antimo在LinearLayout中不可能這樣做嗎?我已經完成了佈局設計,並且現在要進行大量的返工工作。 – user2674084
您可以在'LinearLayout'中使用'android:layout_weight'來填充剩餘的空間,然後用'android:gravity =「bottom」' –