Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/210.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Recyclerview scrollToPosition不';无法使用NestedScrollView?还有吗?_Android_Android Recyclerview_Android Scrollview_Android Nestedscrollview_Nestedscrollview - Fatal编程技术网

Android Recyclerview scrollToPosition不';无法使用NestedScrollView?还有吗?

Android Recyclerview scrollToPosition不';无法使用NestedScrollView?还有吗?,android,android-recyclerview,android-scrollview,android-nestedscrollview,nestedscrollview,Android,Android Recyclerview,Android Scrollview,Android Nestedscrollview,Nestedscrollview,因此,我在嵌套滚动视图中有一个回收视图。当我说recycleview.scrollToPosition(X)或recycleview.getLayoutManager().scrollToPosition(X)时,它根本不起作用 如果我将recycleview从nestedScrollView中移出,它可以正常工作,但由于布局结构,我不能这样做!有什么想法吗 scrollingView.requestChildFocus(recyclerView,recyclerView); 尝试了这个,但没

因此,我在
嵌套滚动视图
中有一个
回收视图
。当我说
recycleview.scrollToPosition(X)
recycleview.getLayoutManager().scrollToPosition(X)
时,它根本不起作用

如果我将
recycleview
nestedScrollView
中移出,它可以正常工作,但由于布局结构,我不能这样做!有什么想法吗

scrollingView.requestChildFocus(recyclerView,recyclerView);

尝试了这个,但没有专注于某个特定的位置

让你的回收站看起来像这样

<LinearLayout
      android:id="@+id/ll2"
      android:focusableInTouchMode="true"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">

          <android.support.v7.widget.RecyclerView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="5dp"
              android:clipToPadding="false"
              android:visibility="visible"/>

</LinearLayout>

您是否尝试过循环视图。smoothScrollToPosition(position)?它将不起作用。我的recyclerview在nestedscrollview中。你找到答案了吗?看看这个解决方案,它不起作用。我的recyclerview在nestedscrollview中。您是否将setNestedScrollingEnabled(false)设置为recyclerview@BincyBaby试试最后一个选项你能来gmail吗?bbincybabyy@gmail.com
ItemsArrayList.add(0, items5);
adapter.notifyDataSetChanged();
ViewCompat.setNestedScrollingEnabled(recyclerView,false);
NestedScrollView nestedScrollingView = (NestedScrollView) findViewById(R.id.nestedScrollingView);
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.ll2);
float y = fcRecyclerView.getChildAt(0).getY();
float z =linearLayout.getY();
nestedScrollingView.smoothScrollTo(0, (int) z);