Skip to content

Commit

Permalink
修复RecyclerView水平滑动导致的滑动冲突bug
Browse files Browse the repository at this point in the history
  • Loading branch information
teach committed Jul 14, 2021
1 parent 7d1c457 commit f820723
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static boolean canScrollVertically(View view, int direction) {
if (scrolledView instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) scrolledView;

if (recyclerView.canScrollHorizontally(1) || recyclerView.canScrollVertically(-1)) {
if (recyclerView.canScrollHorizontally(1) || recyclerView.canScrollHorizontally(-1)) {
// 如果recyclerView可以水平滑动,并且使用canScrollVertically判断不能垂直滑动,这认定是不能垂直滑动的。
// 这样做既兼顾了recyclerView同时水平、垂直滑动的情况,又保证了垂直滑动的判断是通过自定义的方式判断的。
if (!recyclerView.canScrollVertically(direction)) {
Expand Down

0 comments on commit f820723

Please sign in to comment.