0
this stackoverflow question이 매우 비슷하지만 Google의 버그가 현재 버전에서 수정되었지만 여전히 문제가 발생했기 때문에 확인했습니다.NestedScrollView를 스크롤 한 후 RecyclerView 내부에서 onClick 메서드가 작동하지 않음
RecyclerView 내부에있는 항목을 클릭하면 NestedScrollView가 스크롤 된 후 NestedScrollView 내에 RecyclerView가 있습니다. onClick 메서드가 제대로 작동하지 않습니다.
아무도 도와 줄 수 있습니까?
public class FixAppBarLayoutBehavior extends AppBarLayout.Behavior {
public FixAppBarLayoutBehavior() {
super();
}
public FixAppBarLayoutBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target,
int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
dxUnconsumed, dyUnconsumed, type);
stopNestedScrollIfNeeded(dyUnconsumed, child, target, type);
}
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child,
View target, int dx, int dy, int[] consumed, int type) {
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
stopNestedScrollIfNeeded(dy, child, target, type);
}
private void stopNestedScrollIfNeeded(int dy, AppBarLayout child, View target, int type) {
if (type == ViewCompat.TYPE_NON_TOUCH) {
final int currOffset = getTopAndBottomOffset();
if ((dy < 0 && currOffset == 0)
|| (dy > 0 && currOffset == -child.getTotalScrollRange())) {
ViewCompat.stopNestedScroll(target, ViewCompat.TYPE_NON_TOUCH);
}
}
}
}
을하고, 우리의 AppBarLayout의 : 감사
감사합니다! 너는 내 날을 구한다! –