【问题标题】:Backgroundcolor of ExpandableListView while scrolling滚动时 ExpandableListView 的背景色
【发布时间】:2012-04-03 05:49:47
【问题描述】:

我的 Android 应用程序中的 ExpandableListView 有问题。我设置了自定义背景颜色,但是在滚动列表时颜色变为黑色,直到滚动停止。这是正常的还是你可以改变“onScrollColor”?

【问题讨论】:

  • 只需设置此属性 android:cacheColorHint = 您正在使用的背景的 rgb 值或“#fff”

标签: android scroll background-color expandablelistview


【解决方案1】:

我遇到了这种问题,并在我的列表 XML android:cacheColorHint = "#00000000" 中使用此属性解决了它

【讨论】:

    【解决方案2】:

    确保您使用 ViewHolder 在 getView 方法中重复使用您的视图

    就像这个例子: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html

    背景是 Android 尝试在滚动时重用视图,如果您不遵守缓存规则(例如,在示例中使用 ViewHolder),您就会遇到所描述的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-07
      • 1970-01-01
      • 2012-06-22
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多