protected internal override void dispatchDraw(android.graphics.Canvas canvas) { base.dispatchDraw(canvas); // Do nothing if there are no tabs. if (getTabCount() == 0) { return; } // If the user specified a custom view for the tab indicators, then // do not draw the bottom strips. if (!mDrawBottomStrips) { // Skip drawing the bottom strips. return; } android.view.View selectedChild = getChildTabViewAt(mSelectedTab); android.graphics.drawable.Drawable leftStrip = mLeftStrip; android.graphics.drawable.Drawable rightStrip = mRightStrip; leftStrip.setState(selectedChild.getDrawableState()); rightStrip.setState(selectedChild.getDrawableState()); if (mStripMoved) { android.graphics.Rect bounds = mBounds; bounds.left = selectedChild.getLeft(); bounds.right = selectedChild.getRight(); int myHeight = getHeight(); leftStrip.setBounds(System.Math.Min(0, bounds.left - leftStrip.getIntrinsicWidth( )), myHeight - leftStrip.getIntrinsicHeight(), bounds.left, myHeight); rightStrip.setBounds(bounds.right, myHeight - rightStrip.getIntrinsicHeight(), System.Math.Max (getWidth(), bounds.right + rightStrip.getIntrinsicWidth()), myHeight); mStripMoved = false; } leftStrip.draw(canvas); rightStrip.draw(canvas); }
protected internal override void onLayout(bool changed, int l, int t, int r, int b) { base.onLayout(changed, l, t, r, b); bool hasTabs = mTabContainer != null && mTabContainer.getVisibility() != GONE; if (mTabContainer != null && mTabContainer.getVisibility() != GONE) { int containerHeight = getMeasuredHeight(); int tabHeight = mTabContainer.getMeasuredHeight(); if ((mActionBarView.getDisplayOptions() & android.app.ActionBar.DISPLAY_SHOW_HOME ) == 0) { // Not showing home, put tabs on top. int count = getChildCount(); { for (int i = 0; i < count; i++) { android.view.View child = getChildAt(i); if (child == mTabContainer) { continue; } if (!mActionBarView.isCollapsed()) { child.offsetTopAndBottom(tabHeight); } } } mTabContainer.layout(l, 0, r, tabHeight); } else { mTabContainer.layout(l, containerHeight - tabHeight, r, containerHeight); } } bool needsInvalidate = false; if (mIsSplit) { if (mSplitBackground != null) { mSplitBackground.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight()); needsInvalidate = true; } } else { if (mBackground != null) { mBackground.setBounds(mActionBarView.getLeft(), mActionBarView.getTop(), mActionBarView .getRight(), mActionBarView.getBottom()); needsInvalidate = true; } if ((mIsStacked = hasTabs && mStackedBackground != null)) { mStackedBackground.setBounds(mTabContainer.getLeft(), mTabContainer.getTop(), mTabContainer .getRight(), mTabContainer.getBottom()); needsInvalidate = true; } } if (needsInvalidate) { invalidate(); } }