自定义listView ,重写onMeasure 方法
@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);
}
将自定义的listView按照普通listview的使用方法使用就可以了。
本文介绍了一种自定义ListView的方法,通过重写onMeasure方法来优化ListView的显示效果。具体实现方式为设置高度测量规格,使其能够更好地适应界面布局。
2680

被折叠的 条评论
为什么被折叠?



