List items are always as wide as the ListView.

On Tue, May 26, 2009 at 2:19 AM, HenrikH <[email protected]> wrote:
>
> Hi,
>
> I'm trying to make a list that contains elements not necessarily
> occupying the entire width of the screen, but even if using
> android:layout_width="wrap_content" on my elements, they always behave
> as if their width value were set to "fill_parent" instead.
> If I set a fixed value for the width, e.g. "100px", that value is
> indeed used, but I just can't get wrap_content to work.
>
> Example simple list item:
>
> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>        android:layout_width="wrap_content"
> android:layout_height="wrap_content"
>        android:background="#707">
>                <TextView android:id="@+id/text1"
>                        android:layout_width="wrap_content"
> android:layout_height="wrap_content"
>                        android:layout_alignParentTop="true"
> android:layout_alignParentRight="true"
>                        android:background="#770"
>                        android:text="Text1" />
>                <TextView android:id="@+id/text2"
>                        android:layout_width="wrap_content"
> android:layout_height="wrap_content"
>                        android:layout_alignParentLeft="true" 
> android:layout_below="@id/
> text1"
>                        android:background="#077"
>                        android:text="Text2" />
> </RelativeLayout>
>
> What am I missing here? How do I accomplish a list item with
> wrap_content behaviour, i.e., where the width of each RelativeLayout
> is adapted to the length of the strings in the contained text views?
>
> BR
> /Henrik
>
> >
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to