Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustScrollView嵌套CustListView无法正常滑动 #24

Closed
susuzero opened this issue Sep 24, 2016 · 6 comments
Closed

CustScrollView嵌套CustListView无法正常滑动 #24

susuzero opened this issue Sep 24, 2016 · 6 comments

Comments

@susuzero
Copy link

你好,很喜欢这个组件,但在使用中遇到一些问题
现有Fragment1跟Fragment2,在Fragment2中使用CustScrollView嵌套了CustListView
且复写了CustListView的如下方法
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); }
然后,就无法正常滑动了,请问该如何解决

@susuzero susuzero changed the title DragScrollView嵌套DragListView无法正常滑动 CustScrollView嵌套CustListView无法正常滑动 Sep 24, 2016
@xmuSistone
Copy link
Owner

你这样写,完全禁止了ListView的懒加载功能,违背了ListView的设计初衷。你想要一次性加载,可以直接LinearLayout.addView取代ListView了。
如果页面中是纯粹的ListView,该仓库中已经存在了一个CustListView,你可以试试

@xmuSistone
Copy link
Owner

如果你外层用了CustScrollView,里面就不要用CustListView了。你自己定义一个ListVIew,不做任何touch分发拦截,onMeasure按你的样子写,CustScrollView一样可以正常工作的。

之所以不能正常工作了,是因为CustScrollVIew和CustListView对Touch的处理已经混乱了

@susuzero
Copy link
Author

susuzero commented Sep 24, 2016

@xmuSistone 谢谢指点

@susuzero
Copy link
Author

@xmuSistone 我自定义了一个ListView,然后在dispatchTouchEvent中return false,但是依然无法正常工作。请问能否给出关键代码,对事件分发不是特别理解,惭愧!

@xmuSistone
Copy link
Owner

直接用custlistview就好

@susuzero
Copy link
Author

目前外层是一个CustScrollView,内层包含好几个ListView和其他非滑动控件,不考虑懒加载。直接使用custListView不满足需求,且改成LinearLayout.addView的方式工作量较大,实在不知如何解决了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants