2012-07-02 36 views
2

我目前在我的應用程序中使用片段,並在其中我有一個列表視圖。當我滾動它變成黑色,我無法弄清楚如何擺脫它。ListView背景黑色當滾動

我檢查了這個頁面: Background ListView becomes black when scrolling

這並沒有工作...任何其他的想法? (它與圖片的ListView和文字相結合)

+0

發佈你的代碼也將幫助我們來幫助你:) – BlackHatSamurai

+0

對不起,這些工作都沒有實際與java中的setCacheColorHint代碼一起工作。奇怪 –

回答

2
<ListView 
      android:id="@+id/listtask" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_marginTop="15dp" 
      android:background="@drawable/back" 
      android:divider="@drawable/divider" 
      android:dividerHeight="1dp" 
      android:padding="5dp" 
      android:cacheColorHint="@android:color/transparent" 
      android:scrollingCache="false" > 
     </ListView> 
5

,或者您也可以設置屬性

android:cacheColorHint="@android:color/transparent" 
android:scrollingCache="false" 

在列表視圖中。

7

您可以設置這樣

<ListView 
     android:id="@+id/list01" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent" 
     android:focusable="true"  
     android:fastScrollEnabled="true" 
     android:focusableInTouchMode="true" 
     android:transcriptMode="normal" 
     android:cacheColorHint="@android:color/transparent" 
     android:scrollingCache="false" 

     /> 

或可以這樣設置

list.getDrawingCache(false); 
list.setScrollingCacheEnabled(false); 
list.setCacheColorHint(Color.TRANSPARENT); 
+1

你不能相信android:scrollingCache =「false」這條線對我來說有多重要,它解決了我的大問題,非常感謝,所以,,, –

2

你也可以試試這個

android:cacheColorHint="#00000000" 
+0

它幫助我......謝謝:-) – andrewww