我有一个Android项目,需要更改最后一个展开的组(将折叠)和被单击的组的布局。在onGroupClick方法中,我有以下代码:
int cnt=list.getChildCount();
//set layout to all groups (for closed group)
for(int i = 0; i < cnt; i`enter code here`++){
View group = adapter.getGroupView(i, false,
null, list);
LinearLayout childLayout = (LinearLayout) group.findViewById(R.id.newsLayout); childLayout.setBackgroundResource(R.layout.group_layout_shape);
}
// set layout of clicked group
LinearLayout groupLayout = (LinearLayout) v.findViewById(R.id.newsLayout);
groupLayout.setBackgroundResource(R.layout.group_layout_opened_shape);`enter code here`
当点击一个组以展开时,它会更改布局,但不会更改折叠的组的布局:( 有人能帮助我吗?