And the answer is... Make sure the parent ListView has its width set to "fill_parent" rather than "wrap_content".
Maybe this will help someone else! On Sep 14, 1:20 pm, WoodManEXP <woodman...@gmail.com> wrote: > Question about custom Views in ListView > > This app is building custom Views for elements of a list view. How can > the custom view be made to fill the entire width of the list view? > > This XML for the element’s view is inflated from this: > > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout android:id="@+id/LinearLayout01" > android:layout_width="fill_parent" > xmlns:android="http://schemas.android.com/apk/res/android" > android:background="#D0D0D0" > android:orientation="vertical" > android:layout_height="wrap_content" > > <TextView android:text="TextView01" > android:id="@+id/TextView01" > android:layout_height="wrap_content" > android:textColor="#FFFFFF" > android:textSize="10pt" > android:textStyle="normal" > android:typeface="normal" > android:layout_width="fill_parent" > android:gravity="center_horizontal" > /> > </LinearLayout> > > In the Eclipse layout editor it looks great. The string “TextView01” > is centered in a gray box centered horizontally in the parent > LinearLayout. > > But when displayed by the ListView, as returned from Adapter.getView > (), it is all to the left. Like the parent LinearLayout.layout_width > was reset to “wrap_content” rather than “fill_parent.” I want the > entire width of the ListView to be filled with this view. > > Any ideas?? > > Thank you! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---