当在Recycledscrollview中使用Recycler时,Smoothscrolltoposition不起作用

时间:2017-01-12 09:59:03

标签: android android-recyclerview nestedscrollview

我正在LinearLayoutManager使用RecyclerViewNestedScrollView位于smoothScrollToPosition内。一切正常,但使用ViewPager自动滚动无法正常工作。

我尝试了stackoverflow中的所有解决方案,但没有一个最终结束了发布而不是搜索。任何人都可以面对类似的问

基本上我的ViewPager有折叠栏。 Fragment项目为NestedScrollView,其布局为RecyclerViewNestedScrollView位于RecyclerView内。你可以指出我可以NestedScrollView直接而不是RecyclerView。但我在<?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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.design.widget.CollapsingToolbarLayout android:layout_width="match_parent" android:layout_height="280dp" app:layout_scrollFlags="scroll"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorAccent" android:text="jshkjashdjasjdh" /> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" /> </LinearLayout> </android.support.v4.widget.NestedScrollView> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" app:srcCompat="@android:drawable/ic_dialog_email" /> 之上有其他用户界面,所以有人可以帮我两天浪费在这里搜索。

以下是我为测试此行为而创建的代码。

classpath:database/_dbchangelog.xml::pm-1::init is now: 3:1deaf0a4f097b6b849022f38c537ce2d
      classpath:database/_dbchangelog.xml::pm-7::init is now: 3:20e80f95d9d5570a72baef55706ad0d4
      classpath:database/_dbchangelog.xml::pm-11::init is now: 3:075b7b18949816c1dd771434814d1462
      classpath:database/_dbchangelog.xml::pm-13::init is now: 3:65b98274ee2ee237eecac81f2c592bd8
      classpath:database/_dbchangelog.xml::pm-15::init is now: 3:85ff7630667ee7fc38701701b16f0345
      classpath:database/_dbchangelog.xml::pm-17::init is now: 3:6942fa10b9f19926c6cd0eae32e3e556
      classpath:database/_dbchangelog.xml::pm-19::init is now: 3:c3787592a6482613500a708d34c5c8ac
      classpath:database/_dbchangelog.xml::pm-20::init is now: 3:5867b027de501c8583a8943ef3d526d9
      classpath:database/_dbchangelog.xml::pm-22::init is now: 3:90a88831937e9e92fad8f3d04e90d71b
      classpath:database/_dbchangelog.xml::pm-24::init is now: 3:accaeaaec8b4fe66f3c92f90cca9a88c
      classpath:database/_dbchangelog.xml::pm-26::init is now: 3:df6a8efd77c403ccc9988554f830ba57

0 个答案:

没有答案