Android listview does not turn black when scrolling. Solution

Source: Internet
Author: User

In Android, listview is the most commonly used control. During the uidesign, many people want to change its background so that it can conform to the overall uidesign, it's easy to change the background. You only need to prepare an image and specify the property Android: Background = "@ drawable/BG". But don't be so happy. When you do this, you will find that the background has changed, however, when you drag or click the blank position in the list, it is found that all listitems are black, which damages the overall effect. The default listitem background is transparent, the background of the listview is fixed, so if the display content of each item and the background of the current item are mixed in real time during scroll of the scroll bar, therefore, the android system uses an attribute called Android: cachecolorhint to optimize this process. The default color value for the black topic is #191919, half of them are black. If you only change the background color, you can directly specify androi D: cachecolorhint indicates the color you want. If you use an image as the background, you only need to specify Android: cachecolorhint as transparent (#00000000, of course, we have to sacrifice some efficiency for beautification.

Note: QQ technology exchange group: add one if you are interested in 108614806.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.