如何将在Android的同一行的两个按钮 [英] How to put two buttons on same line in Android

查看:961
本文介绍了如何将在Android的同一行的两个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何可以将两个按钮放在同一行中我的登录布局在我的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.

这篇关于如何将在Android的同一行的两个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆