Android回到顶部,并下拉刷新

ViewGroup.LayoutParams layoutParams = appBarLayout.getLayoutParams();
AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutParams).getBehavior();
if (behavior != null) {
behavior.setTopAndBottomOffset(0);
}

((NestedScrollView)view.findViewById(R.id.scroll)).smoothScrollTo(0, 0);
refreshLayout.autoRefresh();
我使用的是CoordinatorLayout+SmartRefreshLayout库+NestedScrollView+RecyclerView

参考:https://www.jianshu.com/p/5bee4447a7ac

posted @ 2024-08-22 11:27  only_books  阅读(9)  评论(0编辑  收藏  举报