[英]ListView element background color changes to black while scrolling
我有一個listview
,當我滾動它時,那個listview元素的背景顏色變為黑色。 我嘗試了幾個小時,但沒有得到解決。
我試過了
android:cacheColorHint="@android:color/transparent"
要么
android:cacheColorHint="#00000000"
設置
android:cacheColorHint
變為您用作ListViewItem背景的顏色
就我而言,這很好
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="1dip"
android:layout_weight="1"
android:background="#ffffff"
android:choiceMode="singleChoice"
android:cacheColorHint="@android:color/transparent"
android:scrollingCache="false"
android:fastScrollEnabled="true">
</ListView>
一位開發人員說,您必須強制使用這兩個屬性。
android:cacheColorHint="@android:color/transparent"
android:scrollingCache="false"
您可以使用以下代碼:
// you can use your color also
android:background="@android:color/transparent"
android:cacheColorHint="@android:color/transparent"
兩種顏色應該相同,那么您的問題將得到解決。
希望對您有幫助。
在xml布局內的列表視圖中添加以下屬性。
android:scrollingCache="true"
android:cacheColorHint="#ffffff"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.