PagerTitleStrip
open class PagerTitleStrip : ViewGroup
kotlin.Any | |||
↳ | android.view.View | ||
↳ | android.view.ViewGroup | ||
↳ | androidx.viewpager.widget.PagerTitleStrip |
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 PagerAdapter#getPageTitle(int)
in the adapter supplied to the ViewPager.
For an interactive indicator, see PagerTabStrip
.
Summary
Public constructors | |
---|---|
<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?) |
Public methods | |
---|---|
open Int | |
open Unit | |
open Unit |
setGravity(gravity: Int) Set the |
open Unit |
setNonPrimaryAlpha(@FloatRange(0.0, 1.0) alpha: Float) Set the alpha value used for non-primary page titles. |
open Unit |
setTextColor(@ColorInt color: Int) Set the color value used as the base color for all displayed page titles. |
open Unit |
setTextSize(unit: Int, size: Float) Set the default text size to a given unit and value. |
open Unit |
setTextSpacing(spacingPixels: Int) Set the required spacing between title segments. |
Protected methods | |
---|---|
open Unit | |
open Unit | |
open Unit | |
open Unit |
Public constructors
<init>
PagerTitleStrip(@NonNull context: Context)
<init>
PagerTitleStrip(
@NonNull context: Context,
@Nullable attrs: AttributeSet?)
Public methods
getTextSpacing
open fun getTextSpacing(): Int
Return | |
---|---|
Int |
The required spacing between title segments in pixels |
requestLayout
open fun requestLayout(): Unit
setGravity
open fun setGravity(gravity: Int): Unit
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
open fun setNonPrimaryAlpha(@FloatRange(0.0, 1.0) alpha: Float): Unit
Set the alpha value used for non-primary page titles.
Parameters | |
---|---|
alpha |
Float: Opacity value in the range 0-1f |
setTextColor
open fun setTextColor(@ColorInt color: Int): Unit
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 |