WerieNaimilah
New Member
Alright here it is, this layout will give you 3 images that are all of equal width, that width being as wide as the longest text on the 3 textviews.They are equal width because they match_parent and the parent is wrap_content to the largest TextView.The 3 text views are centered on the background with equals space on the left and right.\[code\]<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#0000FF" android:gravity="center" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" androidrientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FF0000" android:drawableLeft="@drawable/ic_launcher" android:text="view 1"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FF0000" android:drawableLeft="@drawable/ic_launcher" android:text="view 2"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FF0000" android:drawableLeft="@drawable/ic_launcher" android:text="view 3 longer text"/> </LinearLayout></LinearLayout>\[/code\]Like so:
The problem is Lint is giving a warning that the inner LinearLayout is useless. (Which it isn't because it's what makes the inner textviews become all the same width.
Can anyone produce the same layout but without the lint warning?