Skip to content
Henry Tao edited this page Feb 15, 2016 · 2 revisions

How to use another PullDownToRefresh layout?

In case you want to use another PullDownToRefresh layout, consider to use below code. Remember that AppBarLayout only supports RecyclerView and NestedScrollView. The return target view has to be either those supported views.

smoothAppBarLayout.setScrollTargetCallback(new ScrollTargetCallback() {
  @Override
  public View callback(View target) {
    if (target instanceof SwipeRefreshLayout && ((SwipeRefreshLayout) target).getChildCount() > 0) {
      return ((SwipeRefreshLayout) target).getChildAt(0);
    }
    return target;
  }
});

Why does scrolling in ViewPager not work after orientation changed?

Implement ViewPager with FragmentPagerAdapter is kind of tricky in orientation changed. You have to double check if those child fragments are initiated or not. The simplest solution is to use tag. Please refer to my sample code for more details.

Clone this wiki locally