Android(安卓)ListView拖动时背景颜色会变成黑色的解决办法
16lz
2021-01-24
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"
代码中写明listview.setCacheColorHint(0);这样就不会出现这种情况了。
更多相关文章
- C语言函数的递归(上)
- 关于Android(安卓)ListView组件中android:drawSelectorOnTop含义
- Android删除短信的方法
- android ListView内容无限循环显示
- Android(安卓)sensor hal 详解
- Android(安卓)面试--请描述一下Activity的生命周期?
- android手势识别总结
- [置顶] android ndk空指针导致CRASH的问题
- android 中TextView设置部分文字背景色和文字颜色