【问题标题】:Expandablelistview's background becomes whiter when I expand child row当我展开子行时,Expandablelistview 背景变为白色
【发布时间】:2013-02-14 10:43:32
【问题描述】:

当我展开子行时,Expandablelistview 的背景变得更白。我该如何解决?

我设置:

android:cacheColorHint="@null"
android:scrollingCache="false"

我也试过了:

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

但这并不能解决问题。

展开子前的截图:

http://i.imgur.com/fbaKPus.png http://i.imgur.com/pHejwDn.png

之后:

http://i.imgur.com/hftsxhA.png

编辑:

应用程序使用 Sherlock 主题: ...

可扩展列表视图 xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ExpandableListView
        android:id="@+id/expandableListView"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/background"
        android:cacheColorHint="@android:color/transparent"
        android:childDivider="@color/expandablelist_divider"
        android:divider="@color/expandablelist_divider"
        android:dividerHeight="1dp"
        android:groupIndicator="@drawable/expandablelistindicator" >
    </ExpandableListView>

</LinearLayout>

【问题讨论】:

  • 第一张截图没有找到
  • 你试过只用 android:cacheColorHint="@android:color/transparent" 吗?没有 android:scrollingCache="false"
  • 您是否为您的应用程序设置了特定主题?
  • @Nickolaus - 是的,我正在使用 Sherlock 主题:android:theme="@style/Theme.Sherlock.Light.DarkActionBar"
  • 你能把所有的xml文件都贴出来吗?您的 ExpandableListView 是否继承了某种风格?在这种情况下,尝试构建一个继承它的新属性,添加新属性并分配给您的 ExpandableListView。

标签: android expandablelistview


【解决方案1】:

主题导致您的问题,一种方法是创建自定义选择器,或者,我建议使用 Android Holo 颜色生成器,也可以使用来自此 site 的 Android 操作栏样式生成器,它可以创建和谐设计。

【讨论】:

  • 我应该替换哪些文件/属性?我尝试了自定义操作栏样式,但它并没有解决问题。或许我可以修改 Action Bar Sherlock 的源码?
  • 不需要把压缩包里的资源放到你的项目中,可以参考生成器工具制作的样式
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多