0

내 레이아웃에서 ScrollView은 부모이며 Imageview (160dp 높이)이고 자식은 Recyclerview입니다. 시나리오 : 이미지와 10 개의 문자열 항목 목록이 있으며 표시 가능한 목록 항목은 0, 1, 2, 3, 4입니다. 따라서 새로운 listitem이있을 때마다 목록을 업데이트하고 scrollToPosition 메서드 (itemcount -1)를 호출하지만 아무 일도 발생하지 않습니다. 이미 setNestedScrollEnabled(false)이 있습니다.recyclerview가 scrollview/nestedScrollView에있을 때 scrollToPosition 메소드가 작동하지 않습니다.

방법을 시도했는데이 방법을 사용하면 이전 목록의 마지막 항목으로 스크롤되지만 추가 된 새 항목을 표시하기 위해 완전히 스크롤되지 않았습니다. 내 레이아웃입니다

<android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/swipe_refresh_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@null"> 

     <android.support.v4.widget.NestedScrollView 
      android:id="@+id/scrollView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical"> 

       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="140dp" /> 



       <View 
        android:id="@+id/grey_line" 
        android:layout_width="match_parent" 
        android:layout_height="1dp" 
        android:background="@color/light_grey" 
        android:visibility="gone" /> 


       <RelativeLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

        <android.support.v7.widget.RecyclerView 
         android:id="@+id/comments_list" 
         android:focusable="true" 
         android:focusableInTouchMode="true" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:scrollbars="vertical" /> 


       </RelativeLayout> 

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

도와주세요, 고마워요!

+0

당신이 QUES에 대한 답을 가지고나요 당신의 내부

android:focusable="true" android:focudeableInTouchMode="true" 

를 사용하려고하지. ?? 나는 또한 똑같은 문제에 직면하고있다. .. 당신이 그것을 얻으면 나에게 알려줘. –

답변

0

당신이 당신의 레이아웃 내부

android:descendantFocusability="blocksDescendants" 

를 사용 할 수 있습니다.

경우 Recyclerview

+0

작동하지 않았습니다. blocksmore를 사용하지 않고 recyclerview에서 다른 두 옵션을 시도했습니다. 행운을 빕니다 – Deepak

+0

는 내 질문에 편집 됨 – Deepak

관련 문제