解决ScrollView+ListView冲突问题,无需每次计算listview
16lz
2022-06-15
自定义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学习群】
更多相关文章
- Android(安卓)Lamda 学习
- Android有用代码片段(一)(二)....
- cocos2d-x学习之旅(四):1.4 使用eclipse编译Android(安卓)C++
- Android(安卓)studio爬取网页
- Android学习记录使用Gallery实现炫丽的拖动效果
- (转)Android(安卓)Animation学习笔记
- Android学习之菜单
- android之Buffer类及子类学习
- 我的Android进阶之旅------>Android百度地图定位SDK功能学习