开发者

Android - Prevent ListView from shrinking child views

The Android ListView widge开发者_如何学编程t (2.2) has a default behavior that shrinks all the child views when the ListView scrolls.

I want to disable this behavior and do no shrinking of the child views so that they always remain the same size -- how can I do this?


I'm programatically populating a ListView using Views inflated from:

< RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" android:layout_width="fill_parent">

    <ImageView android:id="@+id/actionitem_image"
        android:layout_centerVertical="true" android:layout_width="40dp"
        android:layout_height="40dp" android:scaleType="center" />

    <TextView android:layout_height="wrap_content" android:id="@+id/actionitem_title"
        android:layout_toRightOf="@+id/actionitem_image" android:textColor="@color/white"
        android:text="TITLE" android:textSize="14dp" android:layout_width="fill_parent" />
    <TextView android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/actionitem_image" android:layout_below="@+id/actionitem_title"
        android:id="@+id/actionitem_subtitle" android:text="Sub Title"
        android:textSize="12dp" android:layout_width="fill_parent" />
    <TextView android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/actionitem_image" android:layout_below="@+id/actionitem_subtitle"
        android:id="@+id/actionitem_infoa" android:textSize="10dp"
        android:layout_width="fill_parent" />
    <TextView android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/actionitem_image" android:layout_below="@+id/actionitem_infoa"
        android:id="@+id/actionitem_infob" android:textSize="10dp"
        android:layout_width="fill_parent" />
    <TextView android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/actionitem_image" android:id="@+id/actionitem_infoc"
        android:layout_below="@+id/actionitem_infob" android:textSize="10dp"
        android:layout_width="fill_parent" />
    <TextView android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/actionitem_image" android:id="@+id/actionitem_infod"
        android:layout_below="@+id/actionitem_infoc" android:textSize="10dp"
        android:layout_width="fill_parent" />
</RelativeLayout>

Whenever the list scrolls there is odd behavior with some of the views shrinking.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜