Esempio n. 1
0
 private void scrollToTab(int tabIndex, int positionOffset) {
   final int tabStripChildCount = mTabStrip.getChildCount();
   if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
     return;
   }
   View selectedChild = mTabStrip.getChildAt(tabIndex);
   if (selectedChild != null) {
     int targetScrollX = selectedChild.getLeft() + positionOffset;
     if (tabIndex > 0 || positionOffset > 0) {
       // If we're not at the first child and are mid-scroll, make sure we obey the offset
       targetScrollX -= mTitleOffset;
     }
     scrollTo(targetScrollX, 0);
   }
 }
Esempio n. 2
0
  private void scrollToTab(int tabIndex, int positionOffset) {
    final int tabStripChildCount = mTabStrip.getChildCount();
    if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
      return;
    }

    View selectedChild = mTabStrip.getChildAt(tabIndex);
    if (selectedChild != null) {
      // LinearLayout ll = (LinearLayout) selectedChild;
      // Log.i("LOG", "TYPE: "+((TextView) ll.getChildAt(0)).getText());
      // ((TextView) ll.getChildAt(0)).setText("1212121");
      int targetScrollX = selectedChild.getLeft() + positionOffset;

      if (tabIndex > 0 || positionOffset > 0) {
        // If we're not at the first child and are mid-scroll, make sure we obey the offset
        targetScrollX -= mTitleOffset;
      }

      scrollTo(targetScrollX, 0);
    }
  }