Use a layout_height of 0dip instead of wrap_content for better performance.....how to remove this warning

android, android-layout

Solution

Ok let me explain through an example,

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Hello World!!" />

</LinearLayout>

In the above example I am using `android:layout_weight="1"` for TextView by which I am telling the layout that my TextView will take the full height as of parent layout(LinearLayout). So, in that case `android:layout_height="wrap_content"` is of no use as the `TextView` will have the full size as parent `LinearLayout`. So, in that case its better to add `android:layout_height="0dp"` to make TextView wrap itself to the height of parent Layout.

Problem

How to remove this warning? Use a layout_height of 0dip instead of wrap_content for better performance

Original source