以编程方式滚动到NestedScrollView的顶部
有没有办法通过也触发父项的滚动事件编程滚动到NestedScrollView的顶部?  smoothScrollTo(x, y)不会将滚动事件委托给NestedScrollingParent 。 
我设法做到了(animation滚动):
 CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams(); AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) params.getBehavior(); if (behavior != null) { behavior.onNestedFling(coordinatorLayout, appBarLayout, null, 0, 10000, true); } 
 其中10000是y方向上的速度。 
 NestedScrollView.scrollTo(0, 0); 
 另一种平滑滚动NestedScrollView的方法是使用fullScroll(direct)函数 
 nestedScrollView.fullScroll(View.FOCUS_DOWN); nestedScrollView.fullScroll(View.FOCUS_UP); 
没有为我工作,我不知道为什么这个工作,但这里是我的解决scheme和问题。
将回收站视图添加到嵌套的滚动视图时,在进入该活动时,会在屏幕上显示回收站视图。 为了一直滚动,我不得不使用这个:
 RecyclerView recyclerView = (RecyclerView) findViewById(R.id.details_recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setItemAnimator(new DefaultItemAnimator()); ProductDescriptionAdapter adapter = new ProductDescriptionAdapter(this); adapter.setData(mProduct.getDetails()); recyclerView.setAdapter(adapter); NestedScrollView scrollView = (NestedScrollView) findViewById(R.id.scroll); scrollView.getParent().requestChildFocus(scrollView, scrollView); 
你可以很容易地伪造NestedScrollView级别的滚动。 你基本上告诉coordinatorLayout你只是滚动工具栏的高度。
  NestedScrollView nestedScrollView = (NestedScrollView) getActivity().findViewById(R.id.your_nested_scroll_view); int toolbarHeight = getActivity().findViewById(R.id.toolbar).getHeight(); nestedScrollView.startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); nestedScrollView.dispatchNestedPreScroll(0, toolbarHeight, null, null); nestedScrollView.dispatchNestedScroll(0, 0, 0, 0, new int[]{0, -toolbarHeight}); nestedScrollView.scrollTo(0, nestedScrollView.getBottom());