[英]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.