Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is Android lint showing "nested weights are bad for performance" when none are nested?
    primarykey
    data
    text
    <p>The layout_weight attribute in the last TextView in this layout is being highlighted by lint as causing bad performance. I suspect the name of the lint warning is erroneous as there are no nested weights. There are several stretching views, and I suspect what it means is dependent weighted views.</p> <p>What's the solution, to build this layout, and avoid this lint warning, and improve performance?</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_horizontal" android:background="@drawable/background_gradient" &gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image4" android:layout_margin="6dp" android:contentDescription="@string/PLACEHOLDER_TEXT" /&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="horizontal" &gt; &lt;Button style="@style/dashboard_button" android:id="@+id/home_management" android:text="@string/ICON_MANAGEMENT" /&gt; &lt;Button style="@style/dashboard_button" android:id="@+id/home_calculators" android:text="@string/ICON_CALCULATORS" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="horizontal" &gt; &lt;Button style="@style/dashboard_button" android:id="@+id/home_guidelines" android:text="@string/ICON_GUIDELINES" /&gt; &lt;Button style="@style/dashboard_button" android:id="@+id/home_faq" android:text="@string/ICON_FAQ" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="horizontal" &gt; &lt;Button style="@style/dashboard_button" android:id="@+id/home_refs" android:text="@string/ICON_REFERENCES" /&gt; &lt;Button style="@style/dashboard_button" android:text="" android:visibility="invisible" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical" android:layout_margin="6dp" &gt; &lt;TextView android:text="@string/HOMEPAGE_CONTENT" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center_horizontal" android:textStyle="bold" android:textColor="#FFFFFF" /&gt; &lt;View android:layout_width="8dp" android:layout_height="1dp" /&gt; &lt;ImageView android:id="@+id/home_logo" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:src="@drawable/image7" android:contentDescription="@string/PLACEHOLDER_TEXT" /&gt; &lt;/LinearLayout&gt; &lt;Button android:id="@+id/home_web_site" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/HOMEPAGE_FOOTER" android:paddingLeft="4dp" android:paddingRight="4dp" android:paddingTop="8dp" android:paddingBottom="8dp" android:textSize="12sp" android:background="@drawable/button_red" android:layout_margin="6dp" android:textColor="#FFFFFF" /&gt; &lt;/LinearLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload