added in version 22.1.0
belongs to Maven artifact com.android.support:viewpager:28.0.0-alpha1

PagerTitleStrip

public class PagerTitleStrip
extends ViewGroup

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.v4.view.PagerTitleStrip
Known Direct Subclasses


PagerTitleStrip is a non-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 getPageTitle(int) in the adapter supplied to the ViewPager.

For an interactive indicator, see PagerTabStrip.

Summary

Inherited constants

From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

PagerTitleStrip(Context context)
PagerTitleStrip(Context context, AttributeSet attrs)

Public methods

int getTextSpacing()
void requestLayout()
void setGravity(int gravity)

Set the Gravity used to position text within the title strip.

void setNonPrimaryAlpha(float alpha)

Set the alpha value used for non-primary page titles.

void setTextColor(int color)

Set the color value used as the base color for all displayed page titles.

void setTextSize(int unit, float size)

Set the default text size to a given unit and value.

void setTextSpacing(int spacingPixels)

Set the required spacing between title segments.

Protected methods

void onAttachedToWindow()
void onDetachedFromWindow()
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Inherited methods

From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public constructors

PagerTitleStrip

added in version 22.1.0
PagerTitleStrip (Context context)

Parameters
context Context

PagerTitleStrip

added in version 22.1.0
PagerTitleStrip (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Public methods

getTextSpacing

added in version 22.1.0
int getTextSpacing ()

Returns
int The required spacing between title segments in pixels

requestLayout

void requestLayout ()

setGravity

added in version 22.1.0
void setGravity (int gravity)

Set the Gravity used to position text within the title strip. Only the vertical gravity component is used.

Parameters
gravity int: Gravity constant for positioning title text

setNonPrimaryAlpha

added in version 22.1.0
void setNonPrimaryAlpha (float alpha)

Set the alpha value used for non-primary page titles.

Parameters
alpha float: Opacity value in the range 0-1f

Value is between 0.0 and 1.0 inclusive.

setTextColor

added in version 22.1.0
void setTextColor (int color)

Set the color value used as the base color for all displayed page titles. Alpha will be ignored for non-primary page titles. See setNonPrimaryAlpha(float).

Parameters
color int: Color hex code in 0xAARRGGBB format

setTextSize

added in version 22.1.0
void setTextSize (int unit, 
                float size)

Set the default text size to a given unit and value. See TypedValue for the possible dimension units.

Example: to set the text size to 14px, use setTextSize(TypedValue.COMPLEX_UNIT_PX, 14);

Parameters
unit int: The desired dimension unit

size float: The desired size in the given units

setTextSpacing

added in version 22.1.0
void setTextSpacing (int spacingPixels)

Set the required spacing between title segments.

Parameters
spacingPixels int: Spacing between each title displayed in pixels

Protected methods

onAttachedToWindow

void onAttachedToWindow ()

onDetachedFromWindow

void onDetachedFromWindow ()

onLayout

added in version 22.1.0
void onLayout (boolean changed, 
                int l, 
                int t, 
                int r, 
                int b)

Parameters
changed boolean

l int

t int

r int

b int

onMeasure

void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int