一个界面中,有多个ListView时,如果用原生ListView,位于下面的listview会显示不出来。使用ScrollView也没有用。
解决方法之一是对ListView进行重新,如下所示:
public class MyListView extends ListView {
public MyListView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public MyListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@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);
}
}
如果处理希望整个页面都下拉刷新,可以用如下控件:
com.handmark.pulltorefresh.library.PullToRefreshScrollView