android.support.v4.view
Class PagerTabStrip

java.lang.Object
  extended by ViewGroup
      extended by android.support.v4.view.PagerTitleStrip
          extended by android.support.v4.view.PagerTabStrip

public class PagerTabStrip
extends PagerTitleStrip

PagerTabStrip is an interactive indicator of the current, next, and previous pages of a ViewPager. It is intended to be used as a child view of a ViewPager widget in your XML layout. Add it as a child of a ViewPager in your layout file and set its android:layout_gravity to TOP or BOTTOM to pin it to the top or bottom of the ViewPager. The title from each page is supplied by the method PagerAdapter.getPageTitle(int) in the adapter supplied to the ViewPager.

For a non-interactive indicator, see PagerTitleStrip.


Constructor Summary
PagerTabStrip(Context context)
           
PagerTabStrip(Context context, AttributeSet attrs)
           
 
Method Summary
 boolean getDrawFullUnderline()
          Return whether or not this tab strip will draw a full-width underline.
 int getTabIndicatorColor()
           
protected  void onDraw(Canvas canvas)
           
 boolean onTouchEvent(MotionEvent ev)
           
 void setBackgroundColor(int color)
           
 void setBackgroundDrawable(Drawable d)
           
 void setBackgroundResource(int resId)
           
 void setDrawFullUnderline(boolean drawFull)
          Set whether this tab strip should draw a full-width underline in the current tab indicator color.
 void setPadding(int left, int top, int right, int bottom)
           
 void setTabIndicatorColor(int color)
          Set the color of the tab indicator bar.
 void setTabIndicatorColorResource(int resId)
          Set the color of the tab indicator bar from a color resource.
 void setTextSpacing(int textSpacing)
          Set the required spacing between title segments.
 
Methods inherited from class android.support.v4.view.PagerTitleStrip
getTextSpacing, onAttachedToWindow, onDetachedFromWindow, onLayout, onMeasure, requestLayout, setGravity, setNonPrimaryAlpha, setTextColor, setTextSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagerTabStrip

public PagerTabStrip(Context context)

PagerTabStrip

public PagerTabStrip(Context context,
                     AttributeSet attrs)
Method Detail

setTabIndicatorColor

public void setTabIndicatorColor(int color)
Set the color of the tab indicator bar.

Parameters:
color - Color to set as an 0xRRGGBB value. The high byte (alpha) is ignored.

setTabIndicatorColorResource

public void setTabIndicatorColorResource(int resId)
Set the color of the tab indicator bar from a color resource.

Parameters:
resId - Resource ID of a color resource to load

getTabIndicatorColor

public int getTabIndicatorColor()
Returns:
The current tab indicator color as an 0xRRGGBB value.

setPadding

public void setPadding(int left,
                       int top,
                       int right,
                       int bottom)

setTextSpacing

public void setTextSpacing(int textSpacing)
Description copied from class: PagerTitleStrip
Set the required spacing between title segments.

Overrides:
setTextSpacing in class PagerTitleStrip
Parameters:
textSpacing - Spacing between each title displayed in pixels

setBackgroundDrawable

public void setBackgroundDrawable(Drawable d)

setBackgroundColor

public void setBackgroundColor(int color)

setBackgroundResource

public void setBackgroundResource(int resId)

setDrawFullUnderline

public void setDrawFullUnderline(boolean drawFull)
Set whether this tab strip should draw a full-width underline in the current tab indicator color.

Parameters:
drawFull - true to draw a full-width underline, false otherwise

getDrawFullUnderline

public boolean getDrawFullUnderline()
Return whether or not this tab strip will draw a full-width underline. This defaults to true if no background is set.

Returns:
true if this tab strip will draw a full-width underline in the current tab indicator color.

onTouchEvent

public boolean onTouchEvent(MotionEvent ev)

onDraw

protected void onDraw(Canvas canvas)