http://developer.android.com/resources/articles/layout-tricks-efficiency.html

I have a ListView with the list items laid out in list-item.xml. Each
item has a title, an optional description and an optional image.

According to the article referenced above the title should become
centered vertically in the parent if the description is missing,
however it does not work for me.

Thank you.

Regards,
Brian

8<-------- list-item.xml -------->8
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:id="@+id/widget115"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:padding="6dip"
    xmlns:android="http://schemas.android.com/apk/res/android";>

<ImageView
    android:id="@+id/icon"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_marginLeft="6dip"
    android:contentDescription="@string/icon_content_desc"
    android:src="@drawable/icon" />

<TextView
    android:id="@+id/secondLine"
    android:text="@string/sample_text_second_line"
    android:layout_width="fill_parent"
    android:layout_height="26dip"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_toLeftOf="@id/icon"/>

<TextView
    android:id="@+id/titleLine"
    android:text="@string/app_name"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_toLeftOf="@id/icon"
    android:layout_above="@id/secondLine"
    android:layout_alignWithParentIfMissing="true"
    android:gravity="center_vertical"/>
</RelativeLayout>

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