简体   繁体   中英

Strange ListView scrolling issues

I have a ListView in my app that has a background image. All of the rows are a semi transparent white (#35FFFFFF). Whenever I scroll the list, the rows turn a light green that obscures the background image until I stop scrolling (usually--sort of unpredictable). Sometimes it flickers between the background image/color and the green. And yes, I have set the cache color hint to #00000000. Any advice about this would be appreciated.

ListView xml:

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="7px"        
    android:cacheColorHint="#00000000"
    android:dividerHeight="6px"
    android:"#75ffffff"
    android:background="@drawable/list_bg"
    android:fastScrollEnabled="true"
    />

Row xml:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="18px"
    android:textColor="@android:color/black"
    android:gravity="center_vertical"
    android:background="#35ffffff"
    />

Bitmap xml:

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/list_bg_bitmap"
    android:tileMode="repeat"
    android:dither="true"
    />

try this one:

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="7px"        
    android:cacheColorHint="#00000000"
    android:dividerHeight="6px"
    android:"#75ffffff"
    android:background="@drawable/list_bg"
    android:fastScrollEnabled="true"

    android:drawSelectorOnTop="false"
    />

Check out this link. Sounds like what you are having. It discusses cacheColorHint. That mighe be your fix. http://developer.android.com/resources/articles/listview-backgrounds.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM