I’m doing an Android layout and the compiler says “This LinearLayout layout or its LinearLayout parent is possibly useless”. I want a few edit texts and buttons to be in a vertical layout like a form but all of them with 70% of the screen width. So i did:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:orientation="vertical" >
... my elements...
</LinearLayout>
</LinearLayout>
It worked but why the compilers insists with this warning?
That’s a lint warning, and it’s not perfect. I have a case similar to yours where it warns about a useless container, but it’s really not useless. Many times lint helps, occasionally you just have to pat its head and ignore it.