You can only ignore this warning if you want to keep this layout.
Add to the root of your layout: xmlns:tools="http://schemas.android.com/tools"
. Then in your buttons add tools:ignore="NestedWeights"
.
This can be also done in eclipse by putting the cursor on the yellow line and pressing ctrl + 1
. You can choose ignore.
If you want to improve performance, you can use a TableLayout
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:id="@+id/tableRow1"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:padding="5dip" >
<Button
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="A" />
<Button
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="B" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:padding="5dip" >
<Button
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="C" />
<Button
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="D" />
</TableRow>
</TableLayout>