1
我想把一些按鈕放在我的線性佈局的底部。 該按鈕只出現在文本後面,我希望它出現在文本之後,但在底部。 下面的代碼:如何把按鈕真的在底部
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="30dip"
android:background="@color/background">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_gravity="center" android:layout_height="match_parent">
<TextView
android:id="@+id/test"
android:text="This is a test"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="25dip"
android:textSize="16.5sp" />
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="bottom"
android:text="continue"
android:id="@+id/continuebutton"
/>
</LinearLayout>
</LinearLayout>
它可以幫助,但是有可能將按鈕移動一點點,並且對嗎? – user1015311
取決於高度:您應該添加margin_bottom - 即20dp。取決於水平定位:如果你需要中間,你應該設置centerInHorizontal true,否則你應該設置margin_left或margin_right。 –