您的位置:首页 > 其它

解决ScrollView+ListView冲突问题,无需每次计算listview

2017-05-19 11:26 423 查看
自定义MyListView

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);
// TODO Auto-generated constructor stub
}

public MyListView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}

在xml布局中直接用MyListView替换ListView即可使用


Android学习交流群:523487222


(如果您觉得有用,欢迎加入,一起学习进步)
点击链接加入群【Android学习群】

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: