扩展列表指示器 [英] Expandable List Indicator

查看:117
本文介绍了扩展列表指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个扩展列表

于是两个分别的问题

  1. (我见过索姆类似的问题 但从来没有找到答案)我如何 隐藏的箭头(组指标) 当有没有孩子

    我试图做到这一点的适配器

     公开查看getGroupView(INT groupPosition,布尔isExpanded,查看convertView,ViewGroup中父){
    如果(getChildrenCount(groupPosition)== 0){
          //我如何隐藏组指标呢?
    }
     

    但我坚持那么,怎样才能修改 组指标为空基?

  2. 如何有不同的行为时, 你上的箭头点击(扩大 组)与你点击的标题 组(去一个活动)

解决方案
  1. 您必须设置一个<一个href="http://developer.android.com/reference/android/widget/ExpandableListView.html#setGroupIndicator%28android.graphics.drawable.Drawable%29"相对=nofollow> GroupIndicator 绘制具有不同的状态。请查看 StateListDrawable ,也许是因为state_empty指定空可绘制。

I have an expandable list

so two question

  1. (I've seen somme similar question but never found the answer) How do I hide the arrow ( group indicator) when there's no children

    I tried to do it in the adapter

    public View getGroupView(int groupPosition, boolean isExpanded, View convertView,ViewGroup parent) {
    if(getChildrenCount(groupPosition)==0) {
          // how do i hide the group indicator ?
    }
    

    But I'm stuck So, how can modify the group indicator for empty groups ?

  2. How to have different behavior when you click on the arrow (expands the group) vs you click on the title of the group (go to an activity)

解决方案

  1. You have to set a GroupIndicator drawable with different states. Check out StateListDrawable, maybe for the "state_empty" specify a null drawable.

这篇关于扩展列表指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆