Thanks Kostya,

This worked well in all orientations and all the device sizes I tried!

______________________________
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:layout_width="fill_parent"
android:layout_height="fill_parent">
                <TextView android:id="@+id/list_item_detail_2_text"
                        android:textSize="18dip" android:lines="1"
                        android:layout_marginTop="8dip" 
android:layout_marginBottom="8dip"
                        android:layout_marginLeft="10dip"
android:layout_alignParentLeft="true"
                        android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_marginRight="24dip"
android:ellipsize="marquee">
                </TextView>
                <ImageView      android:id="@+id/list_item_detail_2_button"
                                
android:background="@drawable/double_right_arrow_24x22"
                                android:layout_width="wrap_content"
android:layout_height="wrap_content" android:minWidth="24dp"
                                android:clickable="true"
                                android:layout_marginRight="4dip"
android:layout_marginLeft="8dip"
                                android:layout_alignParentRight="true"
android:layout_centerInParent="true">
                </ImageView>
</RelativeLayout>
_________________________________



On Jul 7, 8:40 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Tudor,
>
> You should try using a RelativeLayout as the only Layout tag in the list
> item. It's certainly powerful enough to arrange both text and image the
> way you intend.
>
> Off top of my head:
>
> For the TextView -
>
> layout_alignParentLeft="true"
> layout_width="wrap_content"
> and margins, if any
>
> For the ImageView -
>
> layout_alignParentRight="true"
> layout_centerVertical="true"
> and margins, if any
>
> You can try for the TextView -
>
> layout_marginRight= <value in dips based on image view width>
> ellipsize= <"end" or "marquee">
>
> This way the text view will grow depending on screen width (including
> orientation changes).
>
> -- Kostya
>
> 07.07.2010 21:14, TudorTihanпишет:
>
>
>
> > That partly works. I made the inner layout a relative one and put the
> > alignment of the image as suggested. If I fix the max width of the
> > text item to 285dip then it will look nice in the portrait view. But
> > that means I'd have to make a ton of adjustments for each screen
> > aspect/size.
> > Any way to have it hide the text automatically?
>
> > On Jul 7, 7:19 pm, Kostya Vasilyev<kmans...@gmail.com>  wrote:
>
> >> Tudor,
>
> >> You can use RelativeLayout, and set
> >> android:layout_alignParentRight="true" in the image.
>
> >> -- Kostya
>
> >> 07.07.2010 20:05, TudorTihanпишет:
>
> >>> Hi guys and gals,
>
> >>> I am having a very difficult time with making complex listview items
> >>> show properly.
>
> >>> I am using the following layout xml for the item:
>
> >>> <code><source>
> >>> <?xml version="1.0" encoding="utf-8"?>
>
> >>> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> >>> android"
> >>>             android:layout_width="fill_parent"
> >>> android:layout_height="fill_parent">
> >>>             <TextView android:id="@+id/TextView01"
> >>> android:layout_width="wrap_content"
> >>>                     android:layout_height="wrap_content" 
> >>> android:textSize="18dip"
> >>>                     android:layout_marginTop="4dip" 
> >>> android:layout_marginBottom="4dip"
> >>> android:layout_marginLeft="10dip" android:text="sdf asdf asdf sdfghsdf
> >>> sdfg sdfgsd fsd fgdsfg sdfg sdfg sdfg sdf" android:lines="1"></
> >>> TextView>
> >>>             <LinearLayout android:id="@+id/zero_view"
> >>>                     android:layout_width="fill_parent"
> >>> android:layout_height="fill_parent" android:gravity="right|
> >>> center_vertical">
> >>>                             <ImageButton android:id="@+id/ImageButton01"
> >>> android:layout_height="wrap_content"
> >>>                                     
> >>> android:background="@drawable/double_right_arrow_24x22"
> >>> android:layout_width="wrap_content"></ImageButton>
> >>>             </LinearLayout>
> >>> </LinearLayout>
> >>> </source></code>
>
> >>> The idea is to put a text (this item is a child of an expandable list
> >>> view item) and a simple arrow icon to the right of the item. The
> >>> problem is that with longer text, the icon doesn't show up, probably
> >>> having been pushed to the right outside the screen. Is there a way to
> >>> make sure I can solve this in a device independent way from the layout
> >>> only? Ideally the text should ellipsize and scroll in the textview, If
> >>> not possible, then it should cut off a few pixels before the icon.
> >>> How can I do this. Please help me asap, I am having problems
> >>> understanding how each layout settings affect the position. Speaking
> >>> of which, is there a comparison with options for each layout, item
> >>> position combinations other than the API Demos source code?
>
> >> --
> >> Kostya Vasilev -- WiFi Manager + pretty widget 
> >> --http://kmansoft.wordpress.com
>
> --
> Kostya Vasilev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com

-- 
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

Reply via email to