ListView拖动时,背景颜色会变成黑色

通过查找API 文档找到这个函数

public voidsetCacheColorHint(int color)

Since: API Level 1

When set to a non-zero value, the cache color hint indicates that this list is always drawn on top of a solid, single-color, opaque background. Zero means that what's behind this object is translucent 透明的 (non solid) or is not made of a single color. This hint will not affect any existing background drawable set on this view ( typically set viasetBackgroundDrawable(Drawable)).

Parameters
color The background color

所以我将这个颜色设置为全0即可

解决方法1:

是在ListView xml文件中加入以下属性即可:

android:cacheColorHint="#00000000"

解决方法2:
代码中写明listview.setCacheColorHint(0);这样就不会出现这种情况了。

更多相关文章

  1. C语言函数的递归(上)
  2. 关于Android(安卓)ListView组件中android:drawSelectorOnTop含义
  3. Android删除短信的方法
  4. android ListView内容无限循环显示
  5. Android(安卓)sensor hal 详解
  6. Android(安卓)面试--请描述一下Activity的生命周期?
  7. android手势识别总结
  8. [置顶] android ndk空指针导致CRASH的问题
  9. android 中TextView设置部分文字背景色和文字颜色

随机推荐

  1. Android下修改hosts文件
  2. Android(安卓)2.2新增Widget之ProtipWidg
  3. 转载关于android高效显示图片的文章---Fr
  4. Adobe AIR for Android(安卓)中的GPU 渲
  5. Android(安卓)ListView组件中androiddraw
  6. Android的View和ViewGroup分析
  7. Android应用程序请求SurfaceFlinger服务
  8. android activity开发文档翻译 - 1 - 基
  9. Android(安卓)Studio保存log到本地
  10. android ListView用法简介