解決Android的ListView控件滾動時背景變黑


如果大家在非黑色背景下使用ListView控件時,Android默認可能在滾動ListView時這個列表控件的背景突然變成黑色。這樣可能導致程序的黑色的背景和主程序的主題既不協調。解決的方法Google在設計Android時也考慮了,在Layout的ListView中加入android:cacheColorHint="#00000000" 的屬性即可。

如:

<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/comList"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white" android:cacheColorHint="#00000000" >

</ListView>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM