내 레이아웃에서 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>
도와주세요, 고마워요!
당신이 QUES에 대한 답을 가지고나요 당신의 내부
를 사용하려고하지. ?? 나는 또한 똑같은 문제에 직면하고있다. .. 당신이 그것을 얻으면 나에게 알려줘. –