listview滑动变黑的问题

来源:互联网 发布:php destruct 编辑:程序博客网 时间:2024/04/27 20:35

ListView是Android开发用到最多的空间了,之前就遇到过拖动ListView变黑的情况,那时是在layout里面写的:

[xhtml] view plaincopy
  1. <ListView android:id="@android:id/list"  
  2.                android:layout_width="fill_parent"   
  3.                android:layout_height="fill_parent"  
  4.                android:layout_weight="1"  
  5.                 android:background="#C0C0C0"  
  6.                android:drawSelectorOnTop="false"  
  7.                android:cacheColorHint="#00000000"/>  

 android:background="#C0C0C0"当改变了原有的背景颜色,要加上android:cacheColorHint="#00000000",透明度为0

今天就遇到一种情况是这个Activity继承了ListActivity然后没有layout,这时候就要在代码里面写了:

[java] view plaincopy
  1. this.getListView().setBackgroundColor(0xffc0c0c0);  
  2. getListView().setCacheColorHint(0);  

原创粉丝点击