ExpandableListView `
**这个是自定义ExpandableListView 控件 解决 在 NestedScrollView 中ExpandableListView 不可滚动 **
/**
* 只需要在自定义ExpandableListView重写这个方法即可
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
1.布局页面使用 控件
<cn.xxxxxx.xxxCustomerExpandableListView
android:id="@+id/ep_expandablelistview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>`
2.在Adapter中 添加设置数据的方法
public void setClientData(ClientDetailRecordNew data){
this.data = data;
}
3.在第二次需要刷新填充数据时 先进行数据填充在进行刷新数据 ExpandableListView 需要折叠一次才能进行数据刷新。
expandableAdapter?.setClientData(填充的新数据) //设置更新的数据
expandableAdapter?.notifyDataSetChanged() //通知adapter数据更新
expandablelistview?.collapseGroup(groupPosition) //关闭展开的数据
expandablelistview?.expandGroup(groupPosition) //打开数据