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
测试发现,如果代码中存在listview等可滚动控件,且没有放到布局代码的第一层(如下即为放到第一层)
会存在滑动冲突问题,然而实际应用中,布局肯定十分复杂,很难直接放于第一层 研究源码发现代码中有这样一个方法 findScrollView,是用来寻找布局中可滚动的控件,但仅找了第一层,所以会出现以上问题 尝试将该方法改为递归后解决问题:即从整个布局代码中寻找滚动控件,但如果布局中存在多个滚动控件的话,可能会出问题 代码如下
private View findScrollView(ViewGroup viewGroup) { View child = viewGroup; for (int i = 0; i < viewGroup.getChildCount(); i++) { child = viewGroup.getChildAt(i); if (child instanceof AbsListView || child instanceof ScrollView || child instanceof ViewPager || child instanceof WebView) { return child; } else if (child instanceof ViewGroup) { child = findScrollView((ViewGroup) child); if (child instanceof AbsListView || child instanceof ScrollView || child instanceof ViewPager || child instanceof WebView) { return child; } else { continue; } } else { continue; } } return child;
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
测试发现,如果代码中存在listview等可滚动控件,且没有放到布局代码的第一层(如下即为放到第一层)
会存在滑动冲突问题,然而实际应用中,布局肯定十分复杂,很难直接放于第一层
研究源码发现代码中有这样一个方法 findScrollView,是用来寻找布局中可滚动的控件,但仅找了第一层,所以会出现以上问题
尝试将该方法改为递归后解决问题:即从整个布局代码中寻找滚动控件,但如果布局中存在多个滚动控件的话,可能会出问题
代码如下
The text was updated successfully, but these errors were encountered: