Solution to slide and blacklist of listview in Android

Source: Internet
Author: User

Recently writtenProgramWhen a sliding listview item is encountered, the listview background is always black and I don't know how to solve it. So Baidu just got it done, and it was owned by the blogger.

B blog:

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 of the list, it is found that all listitems are black, which damages the overall effect.
Why?
Starting from the effect of listview,
The default listitem background is transparent, while the listview background remains unchanged. Therefore, when the scroll bar is rolled, if you want to display the content and background of each item in real time
The Android system uses an attribute called Android: cachecolorhint to optimize this process. The default color is displayed under the black topic.
The color value is #191919, so the image just appeared, half of which were black.

What should we do?

If you only change the background color, you can directly specify the Android: cachecolorhint as the color you want. If you use an image as the background, you only need to set
Android: cachecolorhint can be specified as transparent (#00000000). Of course, to beautify the image, you must sacrifice some efficiency.

Related Article

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.