Consider the following code and the output:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow>
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="ABCDE" />
<Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="A" />
<Button
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="ABC" />
</TableRow>
</TableLayout>

The buttons are given same layout_weight, but having different widths. Why they don’t occupy same widths? What can I do to make them to have equal widths (without giving pixel values)?
Changing
layout_widthto0dipwill fix the issue.For more information regarding the reason why this works or the reason to use, check out this explanation.
Glad that it helped.