ExpandableList에서 하나의 그룹 만 있으면 볼 수 있습니다. 그 그룹을 숨기고 싶습니다. 그룹의 데이터 만 보여줍니다. 나에게ExpandableListView in android에서 그룹을 숨기는 방법
답변
설정 부모를 도와주세요 iew vlayout PARAMS hieght 당신의 BaseExpandableListAdapter 당신에게 숨길 수 있도록 부모
1)와 그룹 표시 감추기 제로 :
android:groupIndicator="@android:color/transparent"
을 2) 다음과 같이 비어있는 그룹에 대해 빈 FrameLayout을 반환합니다.
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
//By default the group is hidden
View view = new FrameLayout(context);
String groupTitle = getGroup(groupPosition).toString();
//in case there's more than one group and the group title is not empty then show a TextView within the group bar
if(getGroupCount() > 1 && !groupTitle.isEmpty()) {
view = getGenericView();
((TextView)view).setText(groupTitle);
}
return view;
}
3) 그룹 표시 줄을 표시되지 않는 그룹에 대한 expandGroup 전화 :
expandableListView.expandGroup(GROUP_ID);
4) 당신이 getGroupView 방법에서 프로그래밍 방식으로 이미지 뷰를 추가 할 그룹 표시를 표시합니다. 그룹 표시기 숨기기/표시에 대한 자세한 내용은이 블로그 게시물을 확인하십시오. Hiding group indicator for empty groups
나는이 문제를 해결했으며 이로 인해 내 문제가 해결되었습니다. ListView의 어댑터에서 getGroupView에 다음을 추가하십시오.
if (groupPosition == 0) {
convertView = layoutInflater.inflate(R.layout.blank_layout, null);
} else {
convertView = layoutInflater.inflate(R.layout.group_indicator_cell,null);
}
이렇게하면 목록의 0 번째 그룹이 비워집니다.
여기서 blank 레이아웃은 layout_height = 0dp 인 내부보기가있는 레이아웃입니다. 그것은 작동합니다!
방금 시도했는데 실제로 작동하지만 확장 가능한 목록에 남아있는 보이는 그룹에 이상한 동작이 발생합니다. 그럼에도 불구하고 영리한 솔루션! – LargeGlasses
빈 레이아웃을 반환하는 대신 레이아웃에있는 모든 하위 항목을 검토하고 데이터가 없을 때 view.setVisibility(View.Gone)
을 호출합니다.
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
LinearLayout lo;
if (convertView != null) {
lo = (LinearLayout) convertView;
} else {
lo = (LinearLayout) mLayoutInflater.inflate(R.layout.list_item_group_header, parent, false);
}
int visibility = mData.size() == 0 ? View.GONE : View.VISIBLE;
for (int i = 0; i < lo.getChildCount(); i++) {
lo.getChildAt(i).setVisibility(visibility);
}
return lo;
}
- 1. Android에서 ExpandableListView 평평하게하기
- 2. Android에서 ExpandableListView
- 3. Focusable Items in ExpandableListView
- 4. LinearLayout in ExpandableListView
- 5. 스텐실에서 visio shape 그룹을 숨기는 방법
- 6. ExpandableListView 그룹을 축소하면 내 CheckBox가 선택 취소됩니다.
- 7. android에서 mapView의 회색/흰색 영역을 숨기는 방법
- 8. android에서 커서의 특정 행을 숨기는 방법
- 9. Android에서 버튼 클릭으로 스크롤보기를 확장하고 숨기는 방법
- 10. android에서 활동이 시작될 때 softkeyboad를 숨기는 방법?
- 11. ExpandableListView inside ExpandableListView
- 12. ExpandableListView 위치 관련 문제
- 13. ExpandableListView onExpand 항상 확장 된 그룹을 맨 위로 스크롤
- 14. Android ExpandableListView 그룹을 닫을 때 그룹 번호 가져 오기
- 15. ListView 내 ExpandableListView
- 16. 동적으로 expandablelistview 내에서 expandablelistview 내에서 안드로이드를 만듭니다
- 17. ExpandableListView - 조건부 확장이 가능합니까?
- 18. 2.2에 ExpandableListView 하위 애니메이션으로 애니메이션하기
- 19. UISplitViewController in portrait : 프로그래밍 방식으로 마스터 팝업을 숨기는 방법?
- 20. ExpandableListView onGroupLongClick
- 21. Android - TableLayout to ExpandableListView
- 22. ExpandableListView 필터 텍스트 적용시기 결정
- 23. Android : ExpandableListView 사용자 정의 문제
- 24. 엑셀 컬럼을 숨기는 방법?
- 25. 안드로이드 ExpandableListView 버그
- 26. 게으른 로딩 android ExpandableListView
- 27. #id 객체를 숨기는 방법
- 28. ExpandableListView 자식 이벤트
- 29. 두 개 이상의 레벨을 만드는 방법 expandablelistview
- 30. Android ExpandableListView 그룹 위치 항상 0
제가 parent.getLayoutParams()을 시도한 높이 = 0.; parent.invalidate(); 하지만이하지 않는 것을 : 나는 시도했다 : parent.setLayoutParams (새 ViewGroup.LayoutParams (ViewGroup.LayoutParams.FILL_PARENT, 0)); 하지만 ClassCastException이 시작됩니다. ( 실제로 시도 했습니까? 아니면 당신이 짐작 했습니까? – Giorgio