NestedScrollView안에 RecyclerView를 사용하니 ViewHolder를 붙히고나면 자동으로 아래로 스크롤 되는 문제가 발생하였는데 아래와 같은 방법으로 해결하였습니다.
<androidx.core.widget.NestedScrollView
android:id="@+id/nestedScrollViewMart"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"
tools:context=".apps.before_mvvm.activities.gifticon.MartListActivity" >
android:descendantFocusability="blocksDescendants"
ScrollView안의 ViewGroup의 자식들에 포커스를 차단하면 자동으로 다른 곳에 스크롤 되는 문제를 해결할 수 있습니다.
참고
https://itpangpang.tistory.com/308
descendantFocusability - Child View의 Focus를 제어하자
descendantFocusability Child View의 Focus를 제어하자 ㆍ 시작하기 전에 descendantfocusablility라는 이 속성은 몇몇 특별한 상황에서 필요합니다. ㆍ 물론 사용하는 방법에 따라 유용하게 쓰일수도 있습니다..
itpangpang.tistory.com
댓글