不可滑动ListView、GridView

xiaoxiao2021-02-28  86

记录,以前在网上看到的方法,好久了,不记得看的谁的博客了,这里只当作个人记录,勿怪!

自定义ListView或GridView,覆写onMeasure方法:

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

其可以解决和ScrollView嵌套的滑动冲突。

转载请注明原文地址: https://www.6miu.com/read-51381.html

最新回复(0)