En android, ¿cómo debo poner 2 botones en una fila con la misma anchura y altura?

En android, ¿cómo debo poner 2 botones en una fila con la misma anchura y altura? ¿Qué diseño debo utilizar?

Layout_weight es responsable de configurar componentes en proporciones iguales o diferentes.

Utilizar esta :

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:text="@+id/Button02" android:id="@+id/Button02" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> </LinearLayout> 

Puede utilizar RelativeLayout para poner más de un botón en más de una fila:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginLeft="22dp" android:layout_marginTop="43dp" android:text="Button" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/button1" android:layout_alignBottom="@+id/button1" android:layout_alignParentRight="true" android:layout_marginRight="36dp" android:text="Button" /> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/button1" android:layout_below="@+id/button1" android:layout_marginTop="56dp" android:text="Button" /> <Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/button3" android:layout_alignBottom="@+id/button3" android:layout_alignRight="@+id/button2" android:text="Button" /> </RelativeLayout> 
FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.