[英]How to make the buttons align bottom without any space below the buttons
如何將屏幕底部的按鈕對齊。在布局中,我在scrollview下面有標題,其中包含許多textviews和edittext,最后是我想將其放置在底部沒有任何空間的2個按鈕 看到底部,因為我能夠使其底部對齊,但是按鈕和屏幕之間的布局和按鈕之間的距離很小。
以相反的方式進行操作...打開-相對布局* Button1-父底部為真* Button2-父底部為真,Button1的右側,頂部對齊Button1,底部對齊Button1 *標題-父頂部為真*滾動視圖-標題下方和上方Button1關閉-相對布局
您可以使用android:layout_martin="0dp"
將頁邊距設置為零,但是對於某些Views,這是不夠的,因為用於View背景的9Patch也具有頁邊距。 在這種情況下,您需要將邊距都設置為零,並使用不同的背景9patch。
http://developer.android.com/guide/developing/tools/draw9patch.html
將它們放在單獨的布局中,並安排在父級底部
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/save_content"
android:layout_width="wrap_content"
android:text="save"
android:layout_marginRight="5dp"
android:textColor="#ffffff"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_height="35dp"
android:layout_weight="1"/>
<Button
android:id="@+id/cancel_content"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="cancel"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:layout_weight="1"/>
</LinearLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.