如何将在Android的同一行的两个按钮将在、按钮、两个、Android

2023-09-06 03:20:43 作者:說不出的痛︶▔

我如何可以将两个按钮放在同一行中我的登录布局在我的Andr​​oid应用程序?

How can I place two buttons on the same line in my login layout on my Android application?

推荐答案

只是做一个线性layout.Set方向水平和增加两个buttons.Its准备,你会得到你want.Before张贴这样的问题,请尝试使用Google,你会获得sure.This一张code的回答将帮助你。

Just make a linear layout.Set the orientation to horizontal and add two buttons.Its ready you will get what you want.Before posting such questions try googling you will get the answer for sure.This piece of code will help you.

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

如果要配合在layout.give两个按钮的重量为1,这两个按钮。

if you want to fit the two buttons in the layout.give the weight as 1 for both the buttons.