简体   繁体   English

如何将按钮置于其他和底部android系统之上?

[英]How to put button abover other and at the bottom android?

I would like to know how to put my three buttons at the bottom in the right order. 我想知道如何以正确的顺序将我的三个按钮放在底部。 Actually the three buttons are aligned but at the top. 实际上这三个按钮是对齐的,但在顶部。

Here is my xml code: 这是我的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" />

Did you try this in your XML? 您是否在XML中尝试过?

android:layout_above="@+id/button"
android:layout_below="@+id/button"
android:layout_toLeftOf="@+id/button"
android:layout_toRightOf="@+id/button" 

Edit: 编辑:

Or try: 或尝试:

android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM