본문 바로가기
개발자/Android

[Android]ExpandableListView 나에게 필요한 부분

by Alex.K 2015. 4. 7.
반응형

[Android]ExpandableListView 나에게 필요한 부분


ExpandableListView를 사용할때 Adapter를 어떻게 만들어야하는지는 다른 전문가 분들께서 정말 자세하고 친절하게 써주셨기 때문에

저는 따로 어떻게 생성해야하는지는 적지 않겠습니다.


대신 항상 헷갈리던 부분에 대해서만 간략히 적을건데요.


1. Group 뷰의 왼쪽에 나오는 Indicator 를 없애는 방법


<ExpandableListView

            android:id="@+id/test"

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            android:groupIndicator="@null" >

</ExpandableListView>


저렇게 indicator 속성에 null을 넣어주거나


소스상에서


ExpandableListview epListView = (ExpandableListView)view.findViewById(R.id.testview);

epListView.setGroupIndicator(null);


로 해주시면 됩니다.



2. 리스트뷰 표시할때 Group이 표시되도록 하는 방법

그룹 인덱스만큼 expandGroup(Index) 해주면 됩니다.


for(int i = 0; i < m_GroupList.size(); i++)

{

epListView.expandGroup(i);

}


3. GroupView를 클릭 했을때에도 계속 펼쳐져있는 방법

GroupClick 이벤트를 잡아서 "return true" 해주면 끝~!!!!


epListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

@Override

public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id)

{

return true;

}

});

반응형

댓글