We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我的使用场景如下: ViewPager+Fragment,Fragment中使用LoopViewPagerLayout。 正常使用以及滑动VP没问题;当快速滑动VP时,LoopViewPagerLayout无法释放ViewTreeObserver.OnPreDrawListener接口,导致无限调用一下代码:
public boolean onPreDraw() { Rect firstRect = new Rect(); indicatorLayout.getChildAt(0).getGlobalVisibleRect(firstRect); L.e("firstRect = " + firstRect.toShortString()); Rect lastRect = new Rect(); indicatorLayout.getChildAt(indicators.length - 1).getGlobalVisibleRect(lastRect); L.e("lastRect = " + lastRect.toShortString()); totalDistance = lastRect.left - firstRect.left; L.e("totalDistance = " + totalDistance); indicatorLayout.getViewTreeObserver().removeOnPreDrawListener(this); return false; }
我的建议是放弃OnPreDrawListener接口,使用如下代码计算即可:
totalDistance = 2 * size * (indicators.length-1);
The text was updated successfully, but these errors were encountered:
@momoandy good idea!
我这种方法是动态计算总距离。
这是凑巧了!
indicators的大小,marginRight的大小刚好是size,你说的这个计算总距离刚刚好! 不错,不错
打算使用你的这种方式。
Sorry, something went wrong.
No branches or pull requests
我的使用场景如下:
ViewPager+Fragment,Fragment中使用LoopViewPagerLayout。
正常使用以及滑动VP没问题;当快速滑动VP时,LoopViewPagerLayout无法释放ViewTreeObserver.OnPreDrawListener接口,导致无限调用一下代码:
我的建议是放弃OnPreDrawListener接口,使用如下代码计算即可:
The text was updated successfully, but these errors were encountered: