2012-08-29 2 views
5

가능한 중복 그룹에 대한 ExpandableListView 표시기를 숨기는 방법 : 자녀가없는없이 아이들과 함께

main.xml에이 그룹에 대한
ExpandableListView - hide indicator for groups with no children

숨기기 표시를

<ExpandableListView 
android:id="@+id/elv" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:groupIndicator="@drawable/selector"> 
</ExpandableListView> 

selector.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:state_empty="true" android:drawable="@android:color/transparent"/> 
    <item android:state_expanded="true" android:drawable="@drawable/expanded" /> 
    <item android:drawable="@drawable/collapse" /> 
</selector> 

내 ICS에 대한 나던 일, 모든 상태가 그룹

+0

어댑터의 getChildrenCount (int groupPosition)은 축소 된 그룹에 대해 호출되지 않으므로 버그 인 것 같습니다. 그래서 그들은 비어있는 것으로 취급됩니다. –

답변

11

이에서 시도 가지고 비어 붕괴 것으로 보인다 : 다른

getExpandableListView().setGroupIndicator(null); 

또는

if (getChildrenCount(groupPosition) == 0) { 
     indicator.setVisibility(View.INVISIBLE); 
    } 
else { 
     indicator.setVisibility(View.VISIBLE); 
     indicator.setImageResource(isExpanded ? R.drawable.group_expanded : R.drawable.group_closed); 
    } 
+0

어디에서이 기능을 넣으시겠습니까? – Mahesh

+0

'getGroupView'에서 – Swayam

+9

getGroupView에서 표시기를 얻는 방법은 무엇입니까? – corban

관련 문제