简体   繁体   中英

List header/section color becomes dark while scrolling

I am using the this code to have section/headers in list. http://w2davids.wordpress.com/android-sectioned-headers-in-listviews/

I am setting the color with 50% alpha to list header and my window background color is transparent. So while scrolling header color becomes dark. Any idea how to overcome this. and i have also set android:cacheColorHint="#00000000".

I had the same problem. I set the background color of the header view to the same background colour as the list's parent and it worked.

  • So I had a LinearLayout with a background colour of 'grey'.
  • The list is contained within this layout.
  • The list had android:cacheColorHint="#00000000" set in the XML and no background colour set.
  • The header view is loaded using LayoutInflater, inside my activity and set before the call to the list's setListAdapter.
  • The parent View (or main View) of the list header was also a LinearLayout with a background colour of 'grey'.

Hope this works for you.

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