tags:

views:

213

answers:

0

Hi,

I have a linear layout, and I want the height of this linear layout to be the height of an list item (e.g. an entry row in the CallLog tab of Contacts app).

I have tried, but the height of this is just 1 line of text.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="?android:attr/listPreferredItemHeight">

        <TextView
            android:id="@+id/text3"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:maxLines="1"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:gravity="center_vertical"/>
    </LinearLayout>

And I have tried this also, but it ends up have a lot of space at the bottom of the layout:

        <TextView
            android:id="@+id/text3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:maxLines="1"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:gravity="center_vertical"/>
    </LinearLayout>

Can you please tell me how to solve this?

Thank you.