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
ViewConfiguration类中定义了几个滑动和点击之间的判定参数,如mTouchSlop,默认是8dp,档density=2.0时,mTouchSlop=16px,当滑动距离超过这个值时,会判定为滑动,反之则判定为点击。但是AutoSize改变了density,导致mTouchSlop的值同样发生放大或者缩小,进而导致滑动误触或者很难触发滑动。比如我用GestureDetector去判定长按。原本density=2.0,mTouchSlop=16,用auto size后 mTouchSlop=7,导致长按很难触发,会被判定为滑动。
不需要
可以查看GestureDetector里长按手势的判定逻辑
//判定阈值 touchSlop = configuration.getScaledTouchSlop(); public static ViewConfiguration get(@NonNull @UiContext Context context) { StrictMode.assertConfigurationContext(context, "ViewConfiguration"); final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); final int density = (int) (100.0f * metrics.density); ViewConfiguration configuration = sConfigurations.get(density); if (configuration == null) { configuration = new ViewConfiguration(context); sConfigurations.put(density, configuration); } return configuration; }
AutoSize应该只改变ui相关的density,非ui相关的density应该还原。 可以通过反射将ViewConfiguration还原。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment
Bug Description:
ViewConfiguration类中定义了几个滑动和点击之间的判定参数,如mTouchSlop,默认是8dp,档density=2.0时,mTouchSlop=16px,当滑动距离超过这个值时,会判定为滑动,反之则判定为点击。但是AutoSize改变了density,导致mTouchSlop的值同样发生放大或者缩小,进而导致滑动误触或者很难触发滑动。比如我用GestureDetector去判定长按。原本density=2.0,mTouchSlop=16,用auto size后
mTouchSlop=7,导致长按很难触发,会被判定为滑动。
Log:
Related Code:
可以查看GestureDetector里长按手势的判定逻辑
解决方案:
AutoSize应该只改变ui相关的density,非ui相关的density应该还原。
可以通过反射将ViewConfiguration还原。
The text was updated successfully, but these errors were encountered: