Set two buttons to same width regardless of screen size?
Use android:layout_weight="1"
on both Button
s. Set android:layout_width="0dp"
on both. Since both buttons now have equal weighting, they will now each have half the parent's width.
You can find out more here: http://developer.android.com/guide/topics/ui/layout/linear.html
If what you're looking to do is to make all the buttons the width of the widest button, setting weights isn't going to do that. Rather, you can put all the buttons in a TableLayout:
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/short_text" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/enter_manually" />
</TableRow>
</TableLayout>
This layout will show 2 buttons, one on top of the other, the same width.