Android 中ScrollView与ListView冲突问题的解决办法
16lz
2021-01-23
Android 中ScrollView与ListView冲突问题的解决办法
自定义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系统自带的适配布局activity_list_item
- Android应用程序窗口(Activity)的测量(Measure)、布局(Layout)和绘制(Dr
- Android应用程序窗口(Activity)的测量(Measure)、布局(Layout)和绘制(Dr
- Android Studio 实时显示布局文件Preview窗口
- android 5种布局
- andrid五大布局
- Android长按事件和点击事件问题处理,OnItemLongClickListener和On
- 阿拉伯语布局修改总结
- [置顶] Android ListView高度自适应和ScrollView冲突解决