Android ExpandableListView 无child 时 setGroupIndicator 不需要显示的问题

转自:GMAIL 邮件列表 http://comments.gmane.org/gmane.comp.handhelds.android.devel/82840

==================================================

I've been fighting with styling on ExpandableListView as well (an area
that could use some improvement in a future release).

The problem with the current implementation is in the selector element
for the group expander.  It can be found in expander_group.xml and
looks like this:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_expanded="true"
        android:drawable="@drawable/expander_ic_maximized" />
    <item
        android:drawable="@drawable/expander_ic_minimized" />
</selector>

The problem is that it lacks a state for empty.  The code and
attributes support it (state_empty) but it isn't defined in here.
Here are the hypothetical (completely untested) steps you could use to
achieve this:

- Grab the existing expander_group.xml and put it into your drawable
directory.
- Modify it to include a section for the empty state with no image.
Something like this:
    <item android:state_empty="true" android:drawable="@drawable/
empty"/>
- Modify your ExpandableListView element and set the group indicator
to be your private expander_group.xml

Let us know how it works out.  For myself, I need even more control so
I'm about to move to the "roll my own" stage.

 

======================分割线==================================

貌似这是个仍未修复的BUG,即便写了如下代码,问题仍然存在!

<item android:state_empty="true" android:drawable="@drawable/
empty"/>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值