完成ScrollView 下拉和上提刷新,可以见我分享的资料。
核心说一下 ScrollView 和 ListView 或ExpandableListView显示冲突问题:
方案一:给ListView 设置固定高度。
方案二:计算 动态计算 Adpater 的item 数 * item 高度。
方案三:重写 onMeasure 方法。
publicclass AAExpandableListViewextends ExpandableListView {
public AAExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec) {
// TODO Auto-generated method stub
int expandSpec = MeasureSpec.makeMeasureSpec( Integer.MAX_VALUE >> 2,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}