2010-10-19 8 views
3

Le widget Android ListView (2.2) a un comportement par défaut qui réduit toutes les vues enfants lorsque le ListView défile.Android - Empêcher ListView de réduire les vues enfant

Je veux désactiver ce comportement et ne pas rétrécir les vues enfant afin qu'elles restent toujours de la même taille - comment puis-je faire cela?

+0

À quoi ressemble votre mise en page? – EboMike

+0

Je construis le ListView par programmation avec FILL_PARENT, et ces ensembles: setPadding (5, 5, 5, 5); setCacheColorHint (0); setBackgroundColor (Color.argb (200, 0, 0, 0)); – jjj

+3

"Le widget Android ListView (2.2) a un comportement par défaut qui réduit toutes les vues enfant lorsque le ListView défile." - Tu as un code? Je n'ai pas vu ce comportement. – CommonsWare

Répondre

0

Je peuplant un programatically ListView en utilisant Vues gonflé de:

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

Chaque fois que la liste défile il y a un comportement étrange avec quelques-uns des points de vue qui diminuent.