1

페이지를 스크롤하는 동안 onBindViewHolder()가 호출하지 않습니다.사용자 정의 어댑터 함수 (onBindViewHolder)를 호출하지 않는 Scrollview 내부의 Recyclerview

mAdapter.notifyDataSetChanged()가 Scrollview 때문에 데이터를 올바르게 업데이트하지 않습니다. 나는 Recycler에서 3 개의 체크 박스 만 체크했다. 두 번째 데이터 집합을로드하고 알리미를 호출 한 후 더 많은 확인란이 부적절하게 검사되었지만 여전히 데이터가 Model 클래스에서 올바르게 전달됩니다.

보안상의 이유로 여기에 코드를 공유 할 수 없습니다. 나는 이미 하루를 보냈다. 아직 해결되지 않았습니다.

그런 다음 scrollview를 제거해 보았습니다.

스크롤러 내부에 더 많은보기가 있습니다. 그래서 이것을 레이아웃으로 추가하고 Recycler의 첫 번째 위치에 추가했습니다. 그것은 효과가 있었다. 그러나 내가 그 시간을 원할 때마다 단편적인 것으로부터 와야합니다. 이 방법으로 적어도 atymast를 고칠 수있는 방법이 있습니까?

답변

0

@Ogande, 감사합니다. 나는 당신의 코드를 시도했다. 같은 일이 일어나고 있습니다. 그래서 나는 내 질문에 언급했듯이 다른 해결책으로 시도했다.

스크롤보기를 제거하고 Recyclerview 만 유지했습니다.

내 어댑터에 두 개의 레이아웃이 추가되었습니다. 그래서 새로운 레이아웃을 추가하고 싶을 때마다 프래그먼트에서 부울 값을 어댑터에 전달할 때 true로 설정하고 시작시 모든 위치는 기본값으로 false를 취합니다. 따라서 notifychanged()은 새 레이아웃으로 어댑터에 대한 변경 사항을 반영합니다.

예상대로 잘 작동했습니다.

0

난 당신이 예를 들어 android.support.v4.widget.NestedScrollView

ScrollView을 교체해야한다고 생각 :

<?xml version="1.0" encoding="utf-8"?> 
    <android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" > 

    <android.support.design.widget.AppBarLayout 
       android:id="@+id/app_bar" 
       android:layout_width="match_parent" 
       android:layout_height="@dimen/app_bar_height" 
       android:fitsSystemWindows="true" 
       android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.v7.widget.Toolbar 
         android:id="@+id/toolbar" 
         android:layout_width="match_parent" 
         android:layout_height="?attr/actionBarSize" 
         app:layout_collapseMode="pin" 
         app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.widget.NestedScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior" > 

    <!-- Place RecyclerView in here--> 

    </android.support.v4.widget.NestedScrollView> 

    </android.support.design.widget.CoordinatorLayout> 
관련 문제