把HeadView及其子View的Visibility都设置成GONE就行了,只设置HeadView的Visibility不行;
private void setHeadViewVisibility(int visibility){ headlineView.setVisibility(visibility); int childCount=headlineView.getChildCount(); for (int i = 0; i <childCount; i++) { headlineView.getChildAt(i).setVisibility(visibility); } }
ListView隐藏HeadView
时间: 2024-11-08 06:39:04