[英]How to put button abover other and at the bottom android?
我想知道如何以正確的順序將我的三個按鈕放在底部。 實際上這三個按鈕是對齊的,但在頂部。
這是我的xml代碼:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.example.siansa.MainActivity"
tools:ignore="MergeRootFrame">
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/blue"
android:text="@string/connexion"
android:textColor="@color/white" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/red"
android:layout_gravity="bottom"
android:text="@string/inscription"
android:textColor="@color/white" />
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gold"
android:text="@string/guest"
android:layout_gravity="bottom"
android:textColor="@color/white" />
您是否在XML中嘗試過?
android:layout_above="@+id/button"
android:layout_below="@+id/button"
android:layout_toLeftOf="@+id/button"
android:layout_toRightOf="@+id/button"
編輯:
或嘗試:
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.