@Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { layout.onPageScrolled(position, positionOffset, positionOffsetPixels); final View selectedTitle = layout.getChildAt(position); if (selectedTitle == null) { return; } final int selectedTitleOffset = (int) (positionOffset * selectedTitle.getWidth()); int titleLeft = selectedTitle.getLeft() + selectedTitleOffset; if (position > 0) { titleLeft -= titleOffset; } int titleRight = selectedTitle.getRight() + selectedTitleOffset; if (position < layout.getChildCount() - 1) { titleRight += titleOffset; } final int scrollX = getScrollX(); if (titleLeft < scrollX) { // Tab strip overflows to the left. scrollTo(titleLeft, 0); } else if (titleRight > scrollX + getWidth()) { // Tab strip overflows to the right. scrollTo(titleRight - getWidth(), 0); } }
@Override public void setOnTitleClickListener(HomePager.OnTitleClickListener onTitleClickListener) { layout.setOnTitleClickListener(onTitleClickListener); }
@Override public void removeAllPagerViews() { layout.removeAllViews(); }
@Override public void onPageSelected(final int position) { layout.onPageSelected(position); }
@Override public void onAddPagerView(String title) { layout.onAddPagerView(title); }