You are receiving the warning from Lint because computing nested weights is expensive, and the most nested portion must be computed before the next layer can be. This delays drawing the layout to the screen, and is bad for performance.
You can get around this by changing your layout design. Rather than have the Button
s on the bottom arbitrarily take up 30% of the screen, you can have them take up just the layout_height
they need with wrap_content
, or set them to a static height using #dp
. The TextView
at the top will then take up the rest of the top portion of the screen. This is easier for Android to draw, as there aren't any nested weights to compute. Your Lint warning should go away:
<LinearLayout
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:orientation="vertical" >
<TextView
android:id="@+id/news"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:textColor="#0033CC"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/new_order_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="50"
android:text="@string/new_order" />
<Button
android:id="@+id/previous_orders_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="50"
android:text="@string/previous_orders" />
</LinearLayout>