Android - prohibition of viewing listviews ListView

The Android ListView widget (2.2) has a default behavior that compresses all child views when scrolling through a ListView.

I want to disable this behavior and not reduce child views so that they always stay the same size - how can I do this?

+3
source share
1 answer

I programmatically populate 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 a list is scrolled, a strange behavior occurs in which some of the species are reduced.

0
source

Source: https://habr.com/ru/post/1770417/


All Articles