TabLayout

public class TabLayout
extends HorizontalScrollView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.widget.HorizontalScrollView
           ↳ com.google.android.material.tabs.TabLayout


TabLayout provides a horizontal layout to display tabs.

Population of the tabs to display is done through TabLayout.Tab instances. You create tabs via newTab(). From there you can change the tab's label or icon via TabLayout.Tab.setText(int) and TabLayout.Tab.setIcon(int) respectively. To display the tab, you need to add it to the layout via one of the addTab(Tab) methods. For example:

 TabLayout tabLayout = ...;
 tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
 tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
 tabLayout.addTab(tabLayout.newTab().setText("Tab 3"));
 
You should add a listener via addOnTabSelectedListener(OnTabSelectedListener) to be notified when any tab's selection state has been changed.

You can also add items to TabLayout in your layout through the use of TabItem. An example usage is like so:

 <com.google.android.material.tabs.TabLayout
         android:layout_height="wrap_content"
         android:layout_width="match_parent">

     <com.google.android.material.tabs.TabItem
             android:text="@string/tab_text"/>

     <com.google.android.material.tabs.TabItem
             android:icon="@drawable/ic_android"/>

 </com.google.android.material.tabs.TabLayout>
 

ViewPager integration

If you're using a ViewPager together with this layout, you can call setupWithViewPager(ViewPager) to link the two together. This layout will be automatically populated from the PagerAdapter's page titles.

This view also supports being used as part of a ViewPager's decor, and can be added directly to the ViewPager in a layout resource file like so:

 <androidx.viewpager.widget.ViewPager
     android:layout_width="match_parent"
     android:layout_height="match_parent">

     <com.google.android.material.tabs.TabLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="top" />

 </androidx.viewpager.widget.ViewPager>
 

For more information, see the component developer guidance and design guidelines.

See also:

Summary

Nested classes

interface TabLayout.BaseOnTabSelectedListener<T extends TabLayout.Tab>

This interface is deprecated. Use TabLayout.OnTabSelectedListener instead.  

interface TabLayout.OnTabSelectedListener

Callback interface invoked when a tab's selection state changes. 

class TabLayout.Tab

A tab in this layout. 

class TabLayout.TabLayoutOnPageChangeListener

A ViewPager.OnPageChangeListener class which contains the necessary calls back to the provided TabLayout so that the tab position is kept in sync. 

class TabLayout.TabView

A LinearLayout containing TabLayout.Tab instances for use with TabLayout

class TabLayout.ViewPagerOnTabSelectedListener

A TabLayout.OnTabSelectedListener class which contains the necessary calls back to the provided ViewPager so that the tab position is kept in sync. 

Constants

int GRAVITY_CENTER

Gravity used to lay out the tabs in the center of the TabLayout.

int GRAVITY_FILL

Gravity used to fill the TabLayout as much as possible.

int GRAVITY_START

Gravity used to lay out the tabs aligned to the start of the TabLayout.

int INDICATOR_ANIMATION_MODE_ELASTIC

Indicator animation mode used to translate the selected tab indicator by growing and then shrinking the indicator, making the indicator look like it is stretching while translating between destinations.

int INDICATOR_ANIMATION_MODE_FADE

Indicator animation mode used to switch the selected tab indicator from one tab to another by sequentially fading it out from the current destination and in at its new destination.

int INDICATOR_ANIMATION_MODE_LINEAR

Indicator animation mode used to translate the selected tab indicator between two tabs using a linear motion.

int INDICATOR_GRAVITY_BOTTOM

Indicator gravity used to align the tab selection indicator to the bottom of the TabLayout.

int INDICATOR_GRAVITY_CENTER

Indicator gravity used to align the tab selection indicator to the center of the TabLayout.

int INDICATOR_GRAVITY_STRETCH

Indicator gravity used to stretch the tab selection indicator across the entire height of the TabLayout.

int INDICATOR_GRAVITY_TOP

Indicator gravity used to align the tab selection indicator to the top of the TabLayout.

int MODE_AUTO

Auto-sizing tabs behave like MODE_FIXED with GRAVITY_CENTER while the tabs fit within the TabLayout's content width.

int MODE_FIXED

Fixed tabs display all tabs concurrently and are best used with content that benefits from quick pivots between tabs.

int MODE_SCROLLABLE

Scrollable tabs display a subset of tabs at any given moment, and can contain longer tab labels and a larger number of tabs.

int TAB_LABEL_VISIBILITY_LABELED

This mode is set by default.

int TAB_LABEL_VISIBILITY_UNLABELED

If a tab is instantiated with TabLayout.Tab.setText(CharSequence), and this mode is set, the text will be saved and utilized for the content description, but no visible labels will be created.

Inherited constants

int CLIP_TO_PADDING_MASK

int FOCUS_AFTER_DESCENDANTS

int FOCUS_BEFORE_DESCENDANTS

int FOCUS_BLOCK_DESCENDANTS

int LAYOUT_MODE_CLIP_BOUNDS

int LAYOUT_MODE_OPTICAL_BOUNDS

int PERSISTENT_ALL_CACHES

int PERSISTENT_ANIMATION_CACHE

int PERSISTENT_NO_CACHE

int PERSISTENT_SCROLLING_CACHE

int ACCESSIBILITY_DATA_SENSITIVE_AUTO

int ACCESSIBILITY_DATA_SENSITIVE_NO

int ACCESSIBILITY_DATA_SENSITIVE_YES

int ACCESSIBILITY_LIVE_REGION_ASSERTIVE

int ACCESSIBILITY_LIVE_REGION_NONE

int ACCESSIBILITY_LIVE_REGION_POLITE

int AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS

String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE

String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY

String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH

String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR

String AUTOFILL_HINT_CREDIT_CARD_NUMBER

String AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE

String AUTOFILL_HINT_EMAIL_ADDRESS

String AUTOFILL_HINT_NAME

String AUTOFILL_HINT_PASSWORD

String AUTOFILL_HINT_PHONE

String AUTOFILL_HINT_POSTAL_ADDRESS

String AUTOFILL_HINT_POSTAL_CODE

String AUTOFILL_HINT_USERNAME

int AUTOFILL_TYPE_DATE

int AUTOFILL_TYPE_LIST

int AUTOFILL_TYPE_NONE

int AUTOFILL_TYPE_TEXT

int AUTOFILL_TYPE_TOGGLE

int DRAG_FLAG_ACCESSIBILITY_ACTION

int DRAG_FLAG_GLOBAL

int DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION

int DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION

int DRAG_FLAG_GLOBAL_URI_READ

int DRAG_FLAG_GLOBAL_URI_WRITE

int DRAG_FLAG_OPAQUE

int DRAWING_CACHE_QUALITY_AUTO

int DRAWING_CACHE_QUALITY_HIGH

int DRAWING_CACHE_QUALITY_LOW

int FIND_VIEWS_WITH_CONTENT_DESCRIPTION

int FIND_VIEWS_WITH_TEXT

int FOCUSABLE

int FOCUSABLES_ALL

int FOCUSABLES_TOUCH_MODE

int FOCUSABLE_AUTO

int FOCUS_BACKWARD

int FOCUS_DOWN

int FOCUS_FORWARD

int FOCUS_LEFT

int FOCUS_RIGHT

int FOCUS_UP

int GONE

int HAPTIC_FEEDBACK_ENABLED

int IMPORTANT_FOR_ACCESSIBILITY_AUTO

int IMPORTANT_FOR_ACCESSIBILITY_NO

int IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS

int IMPORTANT_FOR_ACCESSIBILITY_YES

int IMPORTANT_FOR_AUTOFILL_AUTO

int IMPORTANT_FOR_AUTOFILL_NO

int IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS

int IMPORTANT_FOR_AUTOFILL_YES

int IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS

int IMPORTANT_FOR_CONTENT_CAPTURE_AUTO

int IMPORTANT_FOR_CONTENT_CAPTURE_NO

int IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS

int IMPORTANT_FOR_CONTENT_CAPTURE_YES

int IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS

int INVISIBLE

int KEEP_SCREEN_ON

int LAYER_TYPE_HARDWARE

int LAYER_TYPE_NONE

int LAYER_TYPE_SOFTWARE

int LAYOUT_DIRECTION_INHERIT

int LAYOUT_DIRECTION_LOCALE

int LAYOUT_DIRECTION_LTR

int LAYOUT_DIRECTION_RTL

int MEASURED_HEIGHT_STATE_SHIFT

int MEASURED_SIZE_MASK

int MEASURED_STATE_MASK

int MEASURED_STATE_TOO_SMALL

int NOT_FOCUSABLE

int NO_ID

int OVER_SCROLL_ALWAYS

int OVER_SCROLL_IF_CONTENT_SCROLLS

int OVER_SCROLL_NEVER

int SCREEN_STATE_OFF

int SCREEN_STATE_ON

int SCROLLBARS_INSIDE_INSET

int SCROLLBARS_INSIDE_OVERLAY

int SCROLLBARS_OUTSIDE_INSET

int SCROLLBARS_OUTSIDE_OVERLAY

int SCROLLBAR_POSITION_DEFAULT

int SCROLLBAR_POSITION_LEFT

int SCROLLBAR_POSITION_RIGHT

int SCROLL_AXIS_HORIZONTAL

int SCROLL_AXIS_NONE

int SCROLL_AXIS_VERTICAL

int SCROLL_CAPTURE_HINT_AUTO

int SCROLL_CAPTURE_HINT_EXCLUDE

int SCROLL_CAPTURE_HINT_EXCLUDE_DESCENDANTS

int SCROLL_CAPTURE_HINT_INCLUDE

int SCROLL_INDICATOR_BOTTOM

int SCROLL_INDICATOR_END

int SCROLL_INDICATOR_LEFT

int SCROLL_INDICATOR_RIGHT

int SCROLL_INDICATOR_START

int SCROLL_INDICATOR_TOP

int SOUND_EFFECTS_ENABLED

int STATUS_BAR_HIDDEN

int STATUS_BAR_VISIBLE

int SYSTEM_UI_FLAG_FULLSCREEN

int SYSTEM_UI_FLAG_HIDE_NAVIGATION

int SYSTEM_UI_FLAG_IMMERSIVE

int SYSTEM_UI_FLAG_IMMERSIVE_STICKY

int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

int SYSTEM_UI_FLAG_LAYOUT_STABLE

int SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR

int SYSTEM_UI_FLAG_LIGHT_STATUS_BAR

int SYSTEM_UI_FLAG_LOW_PROFILE

int SYSTEM_UI_FLAG_VISIBLE

int SYSTEM_UI_LAYOUT_FLAGS

int TEXT_ALIGNMENT_CENTER

int TEXT_ALIGNMENT_GRAVITY

int TEXT_ALIGNMENT_INHERIT

int TEXT_ALIGNMENT_TEXT_END

int TEXT_ALIGNMENT_TEXT_START

int TEXT_ALIGNMENT_VIEW_END

int TEXT_ALIGNMENT_VIEW_START

int TEXT_DIRECTION_ANY_RTL

int TEXT_DIRECTION_FIRST_STRONG

int TEXT_DIRECTION_FIRST_STRONG_LTR

int TEXT_DIRECTION_FIRST_STRONG_RTL

int TEXT_DIRECTION_INHERIT

int TEXT_DIRECTION_LOCALE

int TEXT_DIRECTION_LTR

int TEXT_DIRECTION_RTL

String VIEW_LOG_TAG

int VISIBLE

Inherited fields

public static final Property<View, Float> ALPHA

protected static final int[] EMPTY_STATE_SET

protected static final int[] ENABLED_FOCUSED_SELECTED_STATE_SET

protected static final int[] ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET

protected static final int[] ENABLED_FOCUSED_STATE_SET

protected static final int[] ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET

protected static final int[] ENABLED_SELECTED_STATE_SET

protected static final int[] ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET

protected static final int[] ENABLED_STATE_SET

protected static final int[] ENABLED_WINDOW_FOCUSED_STATE_SET

protected static final int[] FOCUSED_SELECTED_STATE_SET

protected static final int[] FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET

protected static final int[] FOCUSED_STATE_SET

protected static final int[] FOCUSED_WINDOW_FOCUSED_STATE_SET

protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET

protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET

protected static final int[] PRESSED_ENABLED_FOCUSED_STATE_SET

protected static final int[] PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET

protected static final int[] PRESSED_ENABLED_SELECTED_STATE_SET

protected static final int[] PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET

protected static final int[] PRESSED_ENABLED_STATE_SET

protected static final int[] PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET

protected static final int[] PRESSED_FOCUSED_SELECTED_STATE_SET

protected static final int[] PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET

protected static final int[] PRESSED_FOCUSED_STATE_SET

protected static final int[] PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET

protected static final int[] PRESSED_SELECTED_STATE_SET

protected static final int[] PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET

protected static final int[] PRESSED_STATE_SET

protected static final int[] PRESSED_WINDOW_FOCUSED_STATE_SET

public static final Property<View, Float> ROTATION

public static final Property<View, Float> ROTATION_X

public static final Property<View, Float> ROTATION_Y

public static final Property<View, Float> SCALE_X

public static final Property<View, Float> SCALE_Y

protected static final int[] SELECTED_STATE_SET

protected static final int[] SELECTED_WINDOW_FOCUSED_STATE_SET

public static final Property<View, Float> TRANSLATION_X

public static final Property<View, Float> TRANSLATION_Y

public static final Property<View, Float> TRANSLATION_Z

protected static final int[] WINDOW_FOCUSED_STATE_SET

public static final Property<View, Float> X

public static final Property<View, Float> Y

public static final Property<View, Float> Z

Public constructors

TabLayout(Context context)
TabLayout(Context context, AttributeSet attrs)
TabLayout(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

void addOnTabSelectedListener(TabLayout.OnTabSelectedListener listener)

Add a TabLayout.OnTabSelectedListener that will be invoked when tab selection changes.

void addOnTabSelectedListener(BaseOnTabSelectedListener listener)

This method is deprecated. use addOnTabSelectedListener(OnTabSelectedListener)

void addTab(TabLayout.Tab tab)

Add a tab to this layout.

void addTab(TabLayout.Tab tab, boolean setSelected)

Add a tab to this layout.

void addTab(TabLayout.Tab tab, int position)

Add a tab to this layout.

void addTab(TabLayout.Tab tab, int position, boolean setSelected)

Add a tab to this layout.

void addView(View child, int index)
void addView(View child, ViewGroup.LayoutParams params)
void addView(View child, int index, ViewGroup.LayoutParams params)
void addView(View child)
void clearOnTabSelectedListeners()

Remove all previously added TabLayout.OnTabSelectedListeners.

FrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs)
int getSelectedTabPosition()

Returns the position of the current selected tab.

TabLayout.Tab getTabAt(int index)

Returns the tab at the specified index.

int getTabCount()

Returns the number of tabs currently registered with the tab layout.

int getTabGravity()

The current gravity used for laying out tabs.

ColorStateList getTabIconTint()

Gets the icon tint for the different states (normal, selected) used for the tabs.

int getTabIndicatorAnimationMode()

Get the current indicator animation mode used to animate the selection indicator between destinations.

int getTabIndicatorGravity()

Get the current indicator gravity used to align the tab selection indicator in the TabLayout.

int getTabMode()

Returns the current mode used by this TabLayout.

ColorStateList getTabRippleColor()

Returns the ripple color for this TabLayout.

Drawable getTabSelectedIndicator()

Returns the selection indicator drawable for this TabLayout.

ColorStateList getTabTextColors()

Gets the text colors for the different states (normal, selected) used for the tabs.

boolean hasUnboundedRipple()

Returns whether this TabLayout has an unbounded ripple effect, or if ripple is bound to the tab item size.

boolean isInlineLabel()

Returns whether tab labels will be displayed inline with tab icons, or if they will be displayed underneath tab icons.

boolean isTabIndicatorFullWidth()

Get whether or not selection indicator width is fit to full width of the tab item, or fit to the tab item's content.

TabLayout.Tab newTab()

Create and return a new TabLayout.Tab.

void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
boolean onInterceptTouchEvent(MotionEvent event)
boolean onTouchEvent(MotionEvent event)
void removeAllTabs()

Remove all tabs from the tab layout and deselect the current tab.

void removeOnTabSelectedListener(TabLayout.OnTabSelectedListener listener)

Remove the given TabLayout.OnTabSelectedListener that was previously added via addOnTabSelectedListener(OnTabSelectedListener).

void removeOnTabSelectedListener(BaseOnTabSelectedListener listener)

This method is deprecated. use removeOnTabSelectedListener(OnTabSelectedListener)

void removeTab(TabLayout.Tab tab)

Remove a tab from the layout.

void removeTabAt(int position)

Remove a tab from the layout.

void selectTab(TabLayout.Tab tab)

Selects the given tab.

void selectTab(TabLayout.Tab tab, boolean updateIndicator)

Selects the given tab.

void setElevation(float elevation)
void setInlineLabel(boolean inline)

Set whether tab labels will be displayed inline with tab icons, or if they will be displayed underneath tab icons.

void setInlineLabelResource(int inlineResourceId)

Set whether tab labels will be displayed inline with tab icons, or if they will be displayed underneath tab icons.

void setOnTabSelectedListener(BaseOnTabSelectedListener listener)

This method is deprecated. Use addOnTabSelectedListener(OnTabSelectedListener) and removeOnTabSelectedListener(OnTabSelectedListener).

void setOnTabSelectedListener(TabLayout.OnTabSelectedListener listener)

This method is deprecated. Use addOnTabSelectedListener(OnTabSelectedListener) and removeOnTabSelectedListener(OnTabSelectedListener).

void setScrollPosition(int position, float positionOffset, boolean updateSelectedTabView, boolean updateIndicatorPosition)

Set the scroll position of the TabLayout.

void setScrollPosition(int position, float positionOffset, boolean updateSelectedTabView)

Set the scroll position of the TabLayout.

void setSelectedTabIndicator(Drawable tabSelectedIndicator)

Sets the selection indicator for this TabLayout.

void setSelectedTabIndicator(int tabSelectedIndicatorResourceId)

Sets the drawable resource to use as the selection indicator for this TabLayout.

void setSelectedTabIndicatorColor(int color)

Sets the tab indicator's color for the currently selected tab.

void setSelectedTabIndicatorGravity(int indicatorGravity)

Set the indicator gravity used to align the tab selection indicator in the TabLayout.

void setSelectedTabIndicatorHeight(int height)

This method is deprecated. If possible, set the intrinsic height directly on a custom indicator drawable passed to setSelectedTabIndicator(Drawable).

void setTabGravity(int gravity)

Set the gravity to use when laying out the tabs.

void setTabIconTint(ColorStateList iconTint)

Sets the icon tint for the different states (normal, selected) used for the tabs.

void setTabIconTintResource(int iconTintResourceId)

Sets the icon tint resource for the different states (normal, selected) used for the tabs.

void setTabIndicatorAnimationMode(int tabIndicatorAnimationMode)

Set the mode by which the selection indicator should animate when moving between destinations.

void setTabIndicatorFullWidth(boolean tabIndicatorFullWidth)

Enable or disable option to fit the tab selection indicator to the full width of the tab item rather than to the tab item's content.

void setTabMode(int mode)

Set the behavior mode for the Tabs in this layout.

void setTabRippleColor(ColorStateList color)

Sets the ripple color for this TabLayout.

void setTabRippleColorResource(int tabRippleColorResourceId)

Sets the ripple color resource for this TabLayout.

void setTabTextColors(int normalColor, int selectedColor)

Sets the text colors for the different states (normal, selected) used for the tabs.

void setTabTextColors(ColorStateList textColor)

Sets the text colors for the different states (normal, selected) used for the tabs.

void setTabsFromPagerAdapter(PagerAdapter adapter)

This method is deprecated. Use setupWithViewPager(ViewPager) to link a TabLayout with a ViewPager together. When that method is used, the TabLayout will be automatically updated when the PagerAdapter is changed.

void setUnboundedRipple(boolean unboundedRipple)

Set whether this TabLayout will have an unbounded ripple effect or if ripple will be bound to the tab item size.

void setUnboundedRippleResource(int unboundedRippleResourceId)

Set whether this TabLayout will have an unbounded ripple effect or if ripple will be bound to the tab item size.

void setupWithViewPager(ViewPager viewPager)

The one-stop shop for setting up this TabLayout with a ViewPager.

void setupWithViewPager(ViewPager viewPager, boolean autoRefresh)

The one-stop shop for setting up this TabLayout with a ViewPager.

boolean shouldDelayChildPressedState()

Protected methods

TabLayout.Tab createTabFromPool()
void onAttachedToWindow()
void onDetachedFromWindow()
void onDraw(Canvas canvas)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
boolean releaseFromTabPool(TabLayout.Tab tab)

Inherited methods

void addView(View arg0, int arg1)
void addView(View arg0)
void addView(View arg0, ViewGroup.LayoutParams arg1)
void addView(View arg0, int arg1, ViewGroup.LayoutParams arg2)
boolean arrowScroll(int arg0)
int computeHorizontalScrollOffset()
int computeHorizontalScrollRange()
void computeScroll()
int computeScrollDeltaToGetChildRectOnScreen(Rect arg0)
boolean dispatchKeyEvent(KeyEvent arg0)
void draw(Canvas arg0)
boolean executeKeyEvent(KeyEvent arg0)
void fling(int arg0)
boolean fullScroll(int arg0)
CharSequence getAccessibilityClassName()
int getLeftEdgeEffectColor()
float getLeftFadingEdgeStrength()
int getMaxScrollAmount()
int getRightEdgeEffectColor()
float getRightFadingEdgeStrength()
boolean isFillViewport()
boolean isSmoothScrollingEnabled()
void measureChild(View arg0, int arg1, int arg2)
void measureChildWithMargins(View arg0, int arg1, int arg2, int arg3, int arg4)
boolean onGenericMotionEvent(MotionEvent arg0)
boolean onInterceptTouchEvent(MotionEvent arg0)
void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4)
void onMeasure(int arg0, int arg1)
void onOverScrolled(int arg0, int arg1, boolean arg2, boolean arg3)
boolean onRequestFocusInDescendants(int arg0, Rect arg1)
void onRestoreInstanceState(Parcelable arg0)
Parcelable onSaveInstanceState()
void onSizeChanged(int arg0, int arg1, int arg2, int arg3)
boolean onTouchEvent(MotionEvent arg0)
boolean pageScroll(int arg0)
void requestChildFocus(View arg0, View arg1)
boolean requestChildRectangleOnScreen(View arg0, Rect arg1, boolean arg2)
void requestDisallowInterceptTouchEvent(boolean arg0)
void requestLayout()
void scrollTo(int arg0, int arg1)
void setEdgeEffectColor(int arg0)
void setFillViewport(boolean arg0)
void setLeftEdgeEffectColor(int arg0)
void setRightEdgeEffectColor(int arg0)
void setSmoothScrollingEnabled(boolean arg0)
boolean shouldDelayChildPressedState()
final void smoothScrollBy(int arg0, int arg1)
final void smoothScrollTo(int arg0, int arg1)
boolean checkLayoutParams(ViewGroup.LayoutParams arg0)
ViewGroup.LayoutParams generateDefaultLayoutParams()
ViewGroup.LayoutParams generateLayoutParams(AttributeSet arg0)
ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams arg0)
CharSequence getAccessibilityClassName()
boolean getConsiderGoneChildrenWhenMeasuring()
boolean getMeasureAllChildren()
void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4)
void onMeasure(int arg0, int arg1)
void setForegroundGravity(int arg0)
void setMeasureAllChildren(boolean arg0)
boolean shouldDelayChildPressedState()
void addChildrenForAccessibility(ArrayList<View> arg0)
void addExtraDataToAccessibilityNodeInfo(AccessibilityNodeInfo arg0, String arg1, Bundle arg2)
void addFocusables(ArrayList<View> arg0, int arg1, int arg2)
void addKeyboardNavigationClusters(Collection<View> arg0, int arg1)
boolean addStatesFromChildren()
void addTouchables(ArrayList<View> arg0)
void addView(View arg0, ViewGroup.LayoutParams arg1)
void addView(View arg0, int arg1)
void addView(View arg0, int arg1, ViewGroup.LayoutParams arg2)
void addView(View arg0)
void addView(View arg0, int arg1, int arg2)
boolean addViewInLayout(View arg0, int arg1, ViewGroup.LayoutParams arg2, boolean arg3)
boolean addViewInLayout(View arg0, int arg1, ViewGroup.LayoutParams arg2)
void attachLayoutAnimationParameters(View arg0, ViewGroup.LayoutParams arg1, int arg2, int arg3)
void attachViewToParent(View arg0, int arg1, ViewGroup.LayoutParams arg2)
void bringChildToFront(View arg0)
boolean canAnimate()
boolean checkLayoutParams(ViewGroup.LayoutParams arg0)
void childDrawableStateChanged(View arg0)
void childHasTransientStateChanged(View arg0, boolean arg1)
void cleanupLayoutState(View arg0)
void clearChildFocus(View arg0)
void clearDisappearingChildren()
void clearFocus()
void debug(int arg0)
void detachAllViewsFromParent()
void detachViewFromParent(int arg0)
void detachViewFromParent(View arg0)
void detachViewsFromParent(int arg0, int arg1)
WindowInsets dispatchApplyWindowInsets(WindowInsets arg0)
boolean dispatchCapturedPointerEvent(MotionEvent arg0)
void dispatchConfigurationChanged(Configuration arg0)
void dispatchCreateViewTranslationRequest(Map<AutofillId, long[]> arg0, int[] arg1, TranslationCapability arg2, List<ViewTranslationRequest> arg3)
void dispatchDisplayHint(int arg0)
boolean dispatchDragEvent(DragEvent arg0)
void dispatchDraw(Canvas arg0)
void dispatchDrawableHotspotChanged(float arg0, float arg1)
void dispatchFinishTemporaryDetach()
void dispatchFreezeSelfOnly(SparseArray<Parcelable> arg0)
boolean dispatchGenericFocusedEvent(MotionEvent arg0)
boolean dispatchGenericPointerEvent(MotionEvent arg0)
boolean dispatchHoverEvent(MotionEvent arg0)
boolean dispatchKeyEvent(KeyEvent arg0)
boolean dispatchKeyEventPreIme(KeyEvent arg0)
boolean dispatchKeyShortcutEvent(KeyEvent arg0)
void dispatchPointerCaptureChanged(boolean arg0)
void dispatchProvideAutofillStructure(ViewStructure arg0, int arg1)
void dispatchProvideStructure(ViewStructure arg0)
void dispatchRestoreInstanceState(SparseArray<Parcelable> arg0)
void dispatchSaveInstanceState(SparseArray<Parcelable> arg0)
void dispatchScrollCaptureSearch(Rect arg0, Point arg1, Consumer<ScrollCaptureTarget> arg2)
void dispatchSetActivated(boolean arg0)
void dispatchSetPressed(boolean arg0)
void dispatchSetSelected(boolean arg0)
void dispatchStartTemporaryDetach()
void dispatchSystemUiVisibilityChanged(int arg0)
void dispatchThawSelfOnly(SparseArray<Parcelable> arg0)
boolean dispatchTouchEvent(MotionEvent arg0)
boolean dispatchTrackballEvent(MotionEvent arg0)
boolean dispatchUnhandledMove(View arg0, int arg1)
void dispatchVisibilityChanged(View arg0, int arg1)
void dispatchWindowFocusChanged(boolean arg0)
void dispatchWindowInsetsAnimationEnd(WindowInsetsAnimation arg0)
void dispatchWindowInsetsAnimationPrepare(WindowInsetsAnimation arg0)
WindowInsets dispatchWindowInsetsAnimationProgress(WindowInsets arg0, List<WindowInsetsAnimation> arg1)
WindowInsetsAnimation.Bounds dispatchWindowInsetsAnimationStart(WindowInsetsAnimation arg0, WindowInsetsAnimation.Bounds arg1)
void dispatchWindowSystemUiVisiblityChanged(int arg0)
void dispatchWindowVisibilityChanged(int arg0)
boolean drawChild(Canvas arg0, View arg1, long arg2)
void drawableStateChanged()
void endViewTransition(View arg0)
View findFocus()
OnBackInvokedDispatcher findOnBackInvokedDispatcherForChild(View arg0, View arg1)
void findViewsWithText(ArrayList<View> arg0, CharSequence arg1, int arg2)
View focusSearch(View arg0, int arg1)
void focusableViewAvailable(View arg0)
boolean gatherTransparentRegion(Region arg0)
ViewGroup.LayoutParams generateDefaultLayoutParams()
ViewGroup.LayoutParams generateLayoutParams(AttributeSet arg0)
ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams arg0)
CharSequence getAccessibilityClassName()
View getChildAt(int arg0)
int getChildCount()
int getChildDrawingOrder(int arg0, int arg1)
final int getChildDrawingOrder(int arg0)
static int getChildMeasureSpec(int arg0, int arg1, int arg2)
boolean getChildStaticTransformation(View arg0, Transformation arg1)
boolean getChildVisibleRect(View arg0, Rect arg1, Point arg2)
boolean getClipChildren()
boolean getClipToPadding()
int getDescendantFocusability()
View getFocusedChild()
LayoutAnimationController getLayoutAnimation()
Animation.AnimationListener getLayoutAnimationListener()
int getLayoutMode()
LayoutTransition getLayoutTransition()
int getNestedScrollAxes()
ViewOverlay getOverlay()
int getPersistentDrawingCache()
boolean getTouchscreenBlocksFocus()
boolean hasFocus()
boolean hasTransientState()
int indexOfChild(View arg0)
final void invalidateChild(View arg0, Rect arg1)
ViewParent invalidateChildInParent(int[] arg0, Rect arg1)
boolean isAlwaysDrawnWithCacheEnabled()
boolean isAnimationCacheEnabled()
boolean isChildrenDrawingOrderEnabled()
boolean isChildrenDrawnWithCacheEnabled()
boolean isLayoutSuppressed()
boolean isMotionEventSplittingEnabled()
boolean isTransitionGroup()
void jumpDrawablesToCurrentState()
final void layout(int arg0, int arg1, int arg2, int arg3)
void measureChild(View arg0, int arg1, int arg2)
void measureChildWithMargins(View arg0, int arg1, int arg2, int arg3, int arg4)
void measureChildren(int arg0, int arg1)
void notifySubtreeAccessibilityStateChanged(View arg0, View arg1, int arg2)
final void offsetDescendantRectToMyCoords(View arg0, Rect arg1)
final void offsetRectIntoDescendantCoords(View arg0, Rect arg1)
void onAttachedToWindow()
int[] onCreateDrawableState(int arg0)
void onDescendantInvalidated(View arg0, View arg1)
void onDetachedFromWindow()
boolean onInterceptHoverEvent(MotionEvent arg0)
boolean onInterceptTouchEvent(MotionEvent arg0)
abstract void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4)
boolean onNestedFling(View arg0, float arg1, float arg2, boolean arg3)
boolean onNestedPreFling(View arg0, float arg1, float arg2)
boolean onNestedPrePerformAccessibilityAction(View arg0, int arg1, Bundle arg2)
void onNestedPreScroll(View arg0, int arg1, int arg2, int[] arg3)
void onNestedScroll(View arg0, int arg1, int arg2, int arg3, int arg4)
void onNestedScrollAccepted(View arg0, View arg1, int arg2)
boolean onRequestFocusInDescendants(int arg0, Rect arg1)
boolean onRequestSendAccessibilityEvent(View arg0, AccessibilityEvent arg1)
PointerIcon onResolvePointerIcon(MotionEvent arg0, int arg1)
boolean onStartNestedScroll(View arg0, View arg1, int arg2)
void onStopNestedScroll(View arg0)
void onViewAdded(View arg0)
void onViewRemoved(View arg0)
void recomputeViewAttributes(View arg0)
void removeAllViews()
void removeAllViewsInLayout()
void removeDetachedView(View arg0, boolean arg1)
void removeView(View arg0)
void removeViewAt(int arg0)
void removeViewInLayout(View arg0)
void removeViews(int arg0, int arg1)
void removeViewsInLayout(int arg0, int arg1)
void requestChildFocus(View arg0, View arg1)
boolean requestChildRectangleOnScreen(View arg0, Rect arg1, boolean arg2)
void requestDisallowInterceptTouchEvent(boolean arg0)
boolean requestFocus(int arg0, Rect arg1)
boolean requestSendAccessibilityEvent(View arg0, AccessibilityEvent arg1)
void requestTransparentRegion(View arg0)
boolean restoreDefaultFocus()
void scheduleLayoutAnimation()
void setAddStatesFromChildren(boolean arg0)
void setAlwaysDrawnWithCacheEnabled(boolean arg0)
void setAnimationCacheEnabled(boolean arg0)
void setChildrenDrawingCacheEnabled(boolean arg0)
void setChildrenDrawingOrderEnabled(boolean arg0)
void setChildrenDrawnWithCacheEnabled(boolean arg0)
void setClipChildren(boolean arg0)
void setClipToPadding(boolean arg0)
void setDescendantFocusability(int arg0)
void setLayoutAnimation(LayoutAnimationController arg0)
void setLayoutAnimationListener(Animation.AnimationListener arg0)
void setLayoutMode(int arg0)
void setLayoutTransition(LayoutTransition arg0)
void setMotionEventSplittingEnabled(boolean arg0)
void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener arg0)
void setPersistentDrawingCache(int arg0)
void setStaticTransformationsEnabled(boolean arg0)
void setTouchscreenBlocksFocus(boolean arg0)
void setTransitionGroup(boolean arg0)
void setWindowInsetsAnimationCallback(WindowInsetsAnimation.Callback arg0)
boolean shouldDelayChildPressedState()
boolean showContextMenuForChild(View arg0, float arg1, float arg2)
boolean showContextMenuForChild(View arg0)
ActionMode startActionModeForChild(View arg0, ActionMode.Callback arg1, int arg2)
ActionMode startActionModeForChild(View arg0, ActionMode.Callback arg1)
void startLayoutAnimation()
void startViewTransition(View arg0)
void suppressLayout(boolean arg0)
void updateViewLayout(View arg0, ViewGroup.LayoutParams arg1)
void addChildrenForAccessibility(ArrayList<View> arg0)
void addExtraDataToAccessibilityNodeInfo(AccessibilityNodeInfo arg0, String arg1, Bundle arg2)
void addFocusables(ArrayList<View> arg0, int arg1)
void addFocusables(ArrayList<View> arg0, int arg1, int arg2)
void addKeyboardNavigationClusters(Collection<View> arg0, int arg1)
void addOnAttachStateChangeListener(View.OnAttachStateChangeListener arg0)
void addOnLayoutChangeListener(View.OnLayoutChangeListener arg0)
void addOnUnhandledKeyEventListener(View.OnUnhandledKeyEventListener arg0)
void addTouchables(ArrayList<View> arg0)
ViewPropertyAnimator animate()
void announceForAccessibility(CharSequence arg0)
void autofill(AutofillValue arg0)
void autofill(SparseArray<AutofillValue> arg0)
boolean awakenScrollBars(int arg0, boolean arg1)
boolean awakenScrollBars(int arg0)
boolean awakenScrollBars()
void bringToFront()
void buildDrawingCache(boolean arg0)
void buildDrawingCache()
void buildLayer()
boolean callOnClick()
boolean canResolveLayoutDirection()
boolean canResolveTextAlignment()
boolean canResolveTextDirection()
boolean canScrollHorizontally(int arg0)
boolean canScrollVertically(int arg0)
final void cancelDragAndDrop()
void cancelLongPress()
final void cancelPendingInputEvents()
boolean checkInputConnectionProxy(View arg0)
void clearAnimation()
void clearFocus()
void clearViewTranslationCallback()
static int combineMeasuredStates(int arg0, int arg1)
int computeHorizontalScrollExtent()
int computeHorizontalScrollOffset()
int computeHorizontalScrollRange()
void computeScroll()
WindowInsets computeSystemWindowInsets(WindowInsets arg0, Rect arg1)
int computeVerticalScrollExtent()
int computeVerticalScrollOffset()
int computeVerticalScrollRange()
AccessibilityNodeInfo createAccessibilityNodeInfo()
void createContextMenu(ContextMenu arg0)
void destroyDrawingCache()
WindowInsets dispatchApplyWindowInsets(WindowInsets arg0)
boolean dispatchCapturedPointerEvent(MotionEvent arg0)
void dispatchConfigurationChanged(Configuration arg0)
void dispatchCreateViewTranslationRequest(Map<AutofillId, long[]> arg0, int[] arg1, TranslationCapability arg2, List<ViewTranslationRequest> arg3)
void dispatchDisplayHint(int arg0)
boolean dispatchDragEvent(DragEvent arg0)
void dispatchDraw(Canvas arg0)
void dispatchDrawableHotspotChanged(float arg0, float arg1)
void dispatchFinishTemporaryDetach()
boolean dispatchGenericFocusedEvent(MotionEvent arg0)
boolean dispatchGenericMotionEvent(MotionEvent arg0)
boolean dispatchGenericPointerEvent(MotionEvent arg0)
boolean dispatchHoverEvent(MotionEvent arg0)
boolean dispatchKeyEvent(KeyEvent arg0)
boolean dispatchKeyEventPreIme(KeyEvent arg0)
boolean dispatchKeyShortcutEvent(KeyEvent arg0)
boolean dispatchNestedFling(float arg0, float arg1, boolean arg2)
boolean dispatchNestedPreFling(float arg0, float arg1)
boolean dispatchNestedPrePerformAccessibilityAction(int arg0, Bundle arg1)
boolean dispatchNestedPreScroll(int arg0, int arg1, int[] arg2, int[] arg3)
boolean dispatchNestedScroll(int arg0, int arg1, int arg2, int arg3, int[] arg4)
void dispatchPointerCaptureChanged(boolean arg0)
boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent arg0)
void dispatchProvideAutofillStructure(ViewStructure arg0, int arg1)
void dispatchProvideStructure(ViewStructure arg0)
void dispatchRestoreInstanceState(SparseArray<Parcelable> arg0)
void dispatchSaveInstanceState(SparseArray<Parcelable> arg0)
void dispatchScrollCaptureSearch(Rect arg0, Point arg1, Consumer<ScrollCaptureTarget> arg2)
void dispatchSetActivated(boolean arg0)
void dispatchSetPressed(boolean arg0)
void dispatchSetSelected(boolean arg0)
void dispatchStartTemporaryDetach()
void dispatchSystemUiVisibilityChanged(int arg0)
boolean dispatchTouchEvent(MotionEvent arg0)
boolean dispatchTrackballEvent(MotionEvent arg0)
boolean dispatchUnhandledMove(View arg0, int arg1)
void dispatchVisibilityChanged(View arg0, int arg1)
void dispatchWindowFocusChanged(boolean arg0)
void dispatchWindowInsetsAnimationEnd(WindowInsetsAnimation arg0)
void dispatchWindowInsetsAnimationPrepare(WindowInsetsAnimation arg0)
WindowInsets dispatchWindowInsetsAnimationProgress(WindowInsets arg0, List<WindowInsetsAnimation> arg1)
WindowInsetsAnimation.Bounds dispatchWindowInsetsAnimationStart(WindowInsetsAnimation arg0, WindowInsetsAnimation.Bounds arg1)
void dispatchWindowSystemUiVisiblityChanged(int arg0)
void dispatchWindowVisibilityChanged(int arg0)
void draw(Canvas arg0)
void drawableHotspotChanged(float arg0, float arg1)
void drawableStateChanged()
View findFocus()
final OnBackInvokedDispatcher findOnBackInvokedDispatcher()
final <T extends View> T findViewById(int arg0)
final <T extends View> T findViewWithTag(Object arg0)
void findViewsWithText(ArrayList<View> arg0, CharSequence arg1, int arg2)
boolean fitSystemWindows(Rect arg0)
View focusSearch(int arg0)
void forceHasOverlappingRendering(boolean arg0)
void forceLayout()
boolean gatherTransparentRegion(Region arg0)
void generateDisplayHash(String arg0, Rect arg1, Executor arg2, DisplayHashResultCallback arg3)
static int generateViewId()
CharSequence getAccessibilityClassName()
View.AccessibilityDelegate getAccessibilityDelegate()
int getAccessibilityLiveRegion()
AccessibilityNodeProvider getAccessibilityNodeProvider()
CharSequence getAccessibilityPaneTitle()
int getAccessibilityTraversalAfter()
int getAccessibilityTraversalBefore()
String getAllowedHandwritingDelegatePackageName()
String getAllowedHandwritingDelegatorPackageName()
float getAlpha()
Animation getAnimation()
Matrix getAnimationMatrix()
IBinder getApplicationWindowToken()
int[] getAttributeResolutionStack(int arg0)
Map<Integer, Integer> getAttributeSourceResourceMap()
String[] getAutofillHints()
final AutofillId getAutofillId()
int getAutofillType()
AutofillValue getAutofillValue()
Drawable getBackground()
BlendMode getBackgroundTintBlendMode()
ColorStateList getBackgroundTintList()
PorterDuff.Mode getBackgroundTintMode()
int getBaseline()
final int getBottom()
float getBottomFadingEdgeStrength()
int getBottomPaddingOffset()
float getCameraDistance()
boolean getClipBounds(Rect arg0)
Rect getClipBounds()
final boolean getClipToOutline()
final ContentCaptureSession getContentCaptureSession()
CharSequence getContentDescription()
final Context getContext()
ContextMenu.ContextMenuInfo getContextMenuInfo()
final boolean getDefaultFocusHighlightEnabled()
static int getDefaultSize(int arg0, int arg1)
Display getDisplay()
final int[] getDrawableState()
Bitmap getDrawingCache()
Bitmap getDrawingCache(boolean arg0)
int getDrawingCacheBackgroundColor()
int getDrawingCacheQuality()
void getDrawingRect(Rect arg0)
long getDrawingTime()
float getElevation()
int getExplicitStyle()
boolean getFilterTouchesWhenObscured()
boolean getFitsSystemWindows()
int getFocusable()
ArrayList<View> getFocusables(int arg0)
void getFocusedRect(Rect arg0)
Drawable getForeground()
int getForegroundGravity()
BlendMode getForegroundTintBlendMode()
ColorStateList getForegroundTintList()
PorterDuff.Mode getForegroundTintMode()
final boolean getGlobalVisibleRect(Rect arg0)
boolean getGlobalVisibleRect(Rect arg0, Point arg1)
Handler getHandler()
float getHandwritingBoundsOffsetBottom()
float getHandwritingBoundsOffsetLeft()
float getHandwritingBoundsOffsetRight()
float getHandwritingBoundsOffsetTop()
Runnable getHandwritingDelegatorCallback()
final boolean getHasOverlappingRendering()
final int getHeight()
void getHitRect(Rect arg0)
int getHorizontalFadingEdgeLength()
int getHorizontalScrollbarHeight()
Drawable getHorizontalScrollbarThumbDrawable()
Drawable getHorizontalScrollbarTrackDrawable()
int getId()
int getImportantForAccessibility()
int getImportantForAutofill()
int getImportantForContentCapture()
boolean getKeepScreenOn()
KeyEvent.DispatcherState getKeyDispatcherState()
int getLabelFor()
int getLayerType()
int getLayoutDirection()
ViewGroup.LayoutParams getLayoutParams()
final int getLeft()
float getLeftFadingEdgeStrength()
int getLeftPaddingOffset()
final boolean getLocalVisibleRect(Rect arg0)
void getLocationInSurface(int[] arg0)
void getLocationInWindow(int[] arg0)
void getLocationOnScreen(int[] arg0)
Matrix getMatrix()
final int getMeasuredHeight()
final int getMeasuredHeightAndState()
final int getMeasuredState()
final int getMeasuredWidth()
final int getMeasuredWidthAndState()
int getMinimumHeight()
int getMinimumWidth()
int getNextClusterForwardId()
int getNextFocusDownId()
int getNextFocusForwardId()
int getNextFocusLeftId()
int getNextFocusRightId()
int getNextFocusUpId()
View.OnFocusChangeListener getOnFocusChangeListener()
int getOutlineAmbientShadowColor()
ViewOutlineProvider getOutlineProvider()
int getOutlineSpotShadowColor()
int getOverScrollMode()
ViewOverlay getOverlay()
int getPaddingBottom()
int getPaddingEnd()
int getPaddingLeft()
int getPaddingRight()
int getPaddingStart()
int getPaddingTop()
final ViewParent getParent()
ViewParent getParentForAccessibility()
float getPivotX()
float getPivotY()
PointerIcon getPointerIcon()
final List<Rect> getPreferKeepClearRects()
String[] getReceiveContentMimeTypes()
Resources getResources()
final boolean getRevealOnFocusHint()
final int getRight()
float getRightFadingEdgeStrength()
int getRightPaddingOffset()
AttachedSurfaceControl getRootSurfaceControl()
View getRootView()
WindowInsets getRootWindowInsets()
float getRotation()
float getRotationX()
float getRotationY()
float getScaleX()
float getScaleY()
int getScrollBarDefaultDelayBeforeFade()
int getScrollBarFadeDuration()
int getScrollBarSize()
int getScrollBarStyle()
int getScrollCaptureHint()
int getScrollIndicators()
final int getScrollX()
final int getScrollY()
int getSolidColor()
int getSourceLayoutResId()
final CharSequence getStateDescription()
StateListAnimator getStateListAnimator()
int getSuggestedMinimumHeight()
int getSuggestedMinimumWidth()
List<Rect> getSystemGestureExclusionRects()
int getSystemUiVisibility()
Object getTag()
Object getTag(int arg0)
int getTextAlignment()
int getTextDirection()
CharSequence getTooltipText()
final int getTop()
float getTopFadingEdgeStrength()
int getTopPaddingOffset()
TouchDelegate getTouchDelegate()
ArrayList<View> getTouchables()
float getTransitionAlpha()
String getTransitionName()
float getTranslationX()
float getTranslationY()
float getTranslationZ()
long getUniqueDrawingId()
int getVerticalFadingEdgeLength()
int getVerticalScrollbarPosition()
Drawable getVerticalScrollbarThumbDrawable()
Drawable getVerticalScrollbarTrackDrawable()
int getVerticalScrollbarWidth()
ViewTranslationResponse getViewTranslationResponse()
ViewTreeObserver getViewTreeObserver()
int getVisibility()
final int getWidth()
int getWindowAttachCount()
WindowId getWindowId()
WindowInsetsController getWindowInsetsController()
int getWindowSystemUiVisibility()
IBinder getWindowToken()
int getWindowVisibility()
void getWindowVisibleDisplayFrame(Rect arg0)
float getX()
float getY()
float getZ()
boolean hasExplicitFocusable()
boolean hasFocus()
boolean hasFocusable()
boolean hasNestedScrollingParent()
boolean hasOnClickListeners()
boolean hasOnLongClickListeners()
boolean hasOverlappingRendering()
boolean hasPointerCapture()
boolean hasTransientState()
boolean hasWindowFocus()
static View inflate(Context arg0, int arg1, ViewGroup arg2)
void invalidate()
void invalidate(Rect arg0)
void invalidate(int arg0, int arg1, int arg2, int arg3)
void invalidateDrawable(Drawable arg0)
void invalidateOutline()
boolean isAccessibilityDataSensitive()
boolean isAccessibilityFocused()
boolean isAccessibilityHeading()
boolean isActivated()
boolean isAttachedToWindow()
boolean isAutoHandwritingEnabled()
boolean isClickable()
boolean isContextClickable()
boolean isCredential()
boolean isDirty()
boolean isDrawingCacheEnabled()
boolean isDuplicateParentStateEnabled()
boolean isEnabled()
final boolean isFocusable()
final boolean isFocusableInTouchMode()
boolean isFocused()
final boolean isFocusedByDefault()
boolean isForceDarkAllowed()
boolean isHandwritingDelegate()
boolean isHapticFeedbackEnabled()
boolean isHardwareAccelerated()
boolean isHorizontalFadingEdgeEnabled()
boolean isHorizontalScrollBarEnabled()
boolean isHovered()
boolean isImportantForAccessibility()
final boolean isImportantForAutofill()
final boolean isImportantForContentCapture()
boolean isInEditMode()
boolean isInLayout()
boolean isInTouchMode()
final boolean isKeyboardNavigationCluster()
boolean isLaidOut()
boolean isLayoutDirectionResolved()
boolean isLayoutRequested()
boolean isLongClickable()
boolean isNestedScrollingEnabled()
boolean isOpaque()
boolean isPaddingOffsetRequired()
boolean isPaddingRelative()
boolean isPivotSet()
final boolean isPreferKeepClear()
boolean isPressed()
boolean isSaveEnabled()
boolean isSaveFromParentEnabled()
boolean isScreenReaderFocusable()
boolean isScrollContainer()
boolean isScrollbarFadingEnabled()
boolean isSelected()
final boolean isShowingLayoutBounds()
boolean isShown()
boolean isSoundEffectsEnabled()
final boolean isTemporarilyDetached()
boolean isTextAlignmentResolved()
boolean isTextDirectionResolved()
boolean isVerticalFadingEdgeEnabled()
boolean isVerticalScrollBarEnabled()
boolean isVisibleToUserForAutofill(int arg0)
void jumpDrawablesToCurrentState()
View keyboardNavigationClusterSearch(View arg0, int arg1)
void layout(int arg0, int arg1, int arg2, int arg3)
final void measure(int arg0, int arg1)
static int[] mergeDrawableStates(int[] arg0, int[] arg1)
void offsetLeftAndRight(int arg0)
void offsetTopAndBottom(int arg0)
void onAnimationEnd()
void onAnimationStart()
WindowInsets onApplyWindowInsets(WindowInsets arg0)
void onAttachedToWindow()
void onCancelPendingInputEvents()
boolean onCapturedPointerEvent(MotionEvent arg0)
boolean onCheckIsTextEditor()
void onConfigurationChanged(Configuration arg0)
void onCreateContextMenu(ContextMenu arg0)
int[] onCreateDrawableState(int arg0)
InputConnection onCreateInputConnection(EditorInfo arg0)
void onCreateViewTranslationRequest(int[] arg0, Consumer<ViewTranslationRequest> arg1)
void onCreateVirtualViewTranslationRequests(long[] arg0, int[] arg1, Consumer<ViewTranslationRequest> arg2)
void onDetachedFromWindow()
void onDisplayHint(int arg0)
boolean onDragEvent(DragEvent arg0)
void onDraw(Canvas arg0)
void onDrawForeground(Canvas arg0)
final void onDrawScrollBars(Canvas arg0)
boolean onFilterTouchEventForSecurity(MotionEvent arg0)
void onFinishInflate()
void onFinishTemporaryDetach()
void onFocusChanged(boolean arg0, int arg1, Rect arg2)
boolean onGenericMotionEvent(MotionEvent arg0)
void onHoverChanged(boolean arg0)
boolean onHoverEvent(MotionEvent arg0)
void onInitializeAccessibilityEvent(AccessibilityEvent arg0)
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo arg0)
boolean onKeyDown(int arg0, KeyEvent arg1)
boolean onKeyLongPress(int arg0, KeyEvent arg1)
boolean onKeyMultiple(int arg0, int arg1, KeyEvent arg2)
boolean onKeyPreIme(int arg0, KeyEvent arg1)
boolean onKeyShortcut(int arg0, KeyEvent arg1)
boolean onKeyUp(int arg0, KeyEvent arg1)
void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4)
void onMeasure(int arg0, int arg1)
void onOverScrolled(int arg0, int arg1, boolean arg2, boolean arg3)
void onPointerCaptureChange(boolean arg0)
void onPopulateAccessibilityEvent(AccessibilityEvent arg0)
void onProvideAutofillStructure(ViewStructure arg0, int arg1)
void onProvideAutofillVirtualStructure(ViewStructure arg0, int arg1)
void onProvideContentCaptureStructure(ViewStructure arg0, int arg1)
void onProvideStructure(ViewStructure arg0)
void onProvideVirtualStructure(ViewStructure arg0)
ContentInfo onReceiveContent(ContentInfo arg0)
PointerIcon onResolvePointerIcon(MotionEvent arg0, int arg1)
void onRestoreInstanceState(Parcelable arg0)
void onRtlPropertiesChanged(int arg0)
Parcelable onSaveInstanceState()
void onScreenStateChanged(int arg0)
void onScrollCaptureSearch(Rect arg0, Point arg1, Consumer<ScrollCaptureTarget> arg2)
void onScrollChanged(int arg0, int arg1, int arg2, int arg3)
boolean onSetAlpha(int arg0)
void onSizeChanged(int arg0, int arg1, int arg2, int arg3)
void onStartTemporaryDetach()
boolean onTouchEvent(MotionEvent arg0)
boolean onTrackballEvent(MotionEvent arg0)
void onViewTranslationResponse(ViewTranslationResponse arg0)
void onVirtualViewTranslationResponses(LongSparseArray<ViewTranslationResponse> arg0)
void onVisibilityAggregated(boolean arg0)
void onVisibilityChanged(View arg0, int arg1)
void onWindowFocusChanged(boolean arg0)
void onWindowSystemUiVisibilityChanged(int arg0)
void onWindowVisibilityChanged(int arg0)
boolean overScrollBy(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, boolean arg8)
boolean performAccessibilityAction(int arg0, Bundle arg1)
boolean performClick()
boolean performContextClick(float arg0, float arg1)
boolean performContextClick()
boolean performHapticFeedback(int arg0)
boolean performHapticFeedback(int arg0, int arg1)
boolean performLongClick(float arg0, float arg1)
boolean performLongClick()
ContentInfo performReceiveContent(ContentInfo arg0)
void playSoundEffect(int arg0)
boolean post(Runnable arg0)
boolean postDelayed(Runnable arg0, long arg1)
void postInvalidate()
void postInvalidate(int arg0, int arg1, int arg2, int arg3)
void postInvalidateDelayed(long arg0, int arg1, int arg2, int arg3, int arg4)
void postInvalidateDelayed(long arg0)
void postInvalidateOnAnimation(int arg0, int arg1, int arg2, int arg3)
void postInvalidateOnAnimation()
void postOnAnimation(Runnable arg0)
void postOnAnimationDelayed(Runnable arg0, long arg1)
void refreshDrawableState()
void releasePointerCapture()
boolean removeCallbacks(Runnable arg0)
void removeOnAttachStateChangeListener(View.OnAttachStateChangeListener arg0)
void removeOnLayoutChangeListener(View.OnLayoutChangeListener arg0)
void removeOnUnhandledKeyEventListener(View.OnUnhandledKeyEventListener arg0)
void requestApplyInsets()
void requestFitSystemWindows()
final boolean requestFocus(int arg0)
final boolean requestFocus()
boolean requestFocus(int arg0, Rect arg1)
final boolean requestFocusFromTouch()
void requestLayout()
void requestPointerCapture()
boolean requestRectangleOnScreen(Rect arg0)
boolean requestRectangleOnScreen(Rect arg0, boolean arg1)
final void requestUnbufferedDispatch(int arg0)
final void requestUnbufferedDispatch(MotionEvent arg0)
final <T extends View> T requireViewById(int arg0)
void resetPivot()
static int resolveSize(int arg0, int arg1)
static int resolveSizeAndState(int arg0, int arg1, int arg2)
boolean restoreDefaultFocus()
void restoreHierarchyState(SparseArray<Parcelable> arg0)
final void saveAttributeDataForStyleable(Context arg0, int[] arg1, AttributeSet arg2, TypedArray arg3, int arg4, int arg5)
void saveHierarchyState(SparseArray<Parcelable> arg0)
void scheduleDrawable(Drawable arg0, Runnable arg1, long arg2)
void scrollBy(int arg0, int arg1)
void scrollTo(int arg0, int arg1)
void sendAccessibilityEvent(int arg0)
void sendAccessibilityEventUnchecked(AccessibilityEvent arg0)
void setAccessibilityDataSensitive(int arg0)
void setAccessibilityDelegate(View.AccessibilityDelegate arg0)
void setAccessibilityHeading(boolean arg0)
void setAccessibilityLiveRegion(int arg0)
void setAccessibilityPaneTitle(CharSequence arg0)
void setAccessibilityTraversalAfter(int arg0)
void setAccessibilityTraversalBefore(int arg0)
void setActivated(boolean arg0)
void setAllowClickWhenDisabled(boolean arg0)
void setAllowedHandwritingDelegatePackage(String arg0)
void setAllowedHandwritingDelegatorPackage(String arg0)
void setAlpha(float arg0)
void setAnimation(Animation arg0)
void setAnimationMatrix(Matrix arg0)
void setAutoHandwritingEnabled(boolean arg0)
void setAutofillHints(String... arg0)
void setAutofillId(AutofillId arg0)
void setBackground(Drawable arg0)
void setBackgroundColor(int arg0)
void setBackgroundDrawable(Drawable arg0)
void setBackgroundResource(int arg0)
void setBackgroundTintBlendMode(BlendMode arg0)
void setBackgroundTintList(ColorStateList arg0)
void setBackgroundTintMode(PorterDuff.Mode arg0)
final void setBottom(int arg0)
void setCameraDistance(float arg0)
void setClickable(boolean arg0)
void setClipBounds(Rect arg0)
void setClipToOutline(boolean arg0)
void setContentCaptureSession(ContentCaptureSession arg0)
void setContentDescription(CharSequence arg0)
void setContextClickable(boolean arg0)
void setDefaultFocusHighlightEnabled(boolean arg0)
void setDrawingCacheBackgroundColor(int arg0)
void setDrawingCacheEnabled(boolean arg0)
void setDrawingCacheQuality(int arg0)
void setDuplicateParentStateEnabled(boolean arg0)
void setElevation(float arg0)
void setEnabled(boolean arg0)
void setFadingEdgeLength(int arg0)
void setFilterTouchesWhenObscured(boolean arg0)
void setFitsSystemWindows(boolean arg0)
void setFocusable(boolean arg0)
void setFocusable(int arg0)
void setFocusableInTouchMode(boolean arg0)
void setFocusedByDefault(boolean arg0)
void setForceDarkAllowed(boolean arg0)
void setForeground(Drawable arg0)
void setForegroundGravity(int arg0)
void setForegroundTintBlendMode(BlendMode arg0)
void setForegroundTintList(ColorStateList arg0)
void setForegroundTintMode(PorterDuff.Mode arg0)
void setHandwritingBoundsOffsets(float arg0, float arg1, float arg2, float arg3)
void setHandwritingDelegatorCallback(Runnable arg0)
void setHapticFeedbackEnabled(boolean arg0)
void setHasTransientState(boolean arg0)
void setHorizontalFadingEdgeEnabled(boolean arg0)
void setHorizontalScrollBarEnabled(boolean arg0)
void setHorizontalScrollbarThumbDrawable(Drawable arg0)
void setHorizontalScrollbarTrackDrawable(Drawable arg0)
void setHovered(boolean arg0)
void setId(int arg0)
void setImportantForAccessibility(int arg0)
void setImportantForAutofill(int arg0)
void setImportantForContentCapture(int arg0)
void setIsCredential(boolean arg0)
void setIsHandwritingDelegate(boolean arg0)
void setKeepScreenOn(boolean arg0)
void setKeyboardNavigationCluster(boolean arg0)
void setLabelFor(int arg0)
void setLayerPaint(Paint arg0)
void setLayerType(int arg0, Paint arg1)
void setLayoutDirection(int arg0)
void setLayoutParams(ViewGroup.LayoutParams arg0)
final void setLeft(int arg0)
final void setLeftTopRightBottom(int arg0, int arg1, int arg2, int arg3)
void setLongClickable(boolean arg0)
final void setMeasuredDimension(int arg0, int arg1)
void setMinimumHeight(int arg0)
void setMinimumWidth(int arg0)
void setNestedScrollingEnabled(boolean arg0)
void setNextClusterForwardId(int arg0)
void setNextFocusDownId(int arg0)
void setNextFocusForwardId(int arg0)
void setNextFocusLeftId(int arg0)
void setNextFocusRightId(int arg0)
void setNextFocusUpId(int arg0)
void setOnApplyWindowInsetsListener(View.OnApplyWindowInsetsListener arg0)
void setOnCapturedPointerListener(View.OnCapturedPointerListener arg0)
void setOnClickListener(View.OnClickListener arg0)
void setOnContextClickListener(View.OnContextClickListener arg0)
void setOnCreateContextMenuListener(View.OnCreateContextMenuListener arg0)
void setOnDragListener(View.OnDragListener arg0)
void setOnFocusChangeListener(View.OnFocusChangeListener arg0)
void setOnGenericMotionListener(View.OnGenericMotionListener arg0)
void setOnHoverListener(View.OnHoverListener arg0)
void setOnKeyListener(View.OnKeyListener arg0)
void setOnLongClickListener(View.OnLongClickListener arg0)
void setOnReceiveContentListener(String[] arg0, OnReceiveContentListener arg1)
void setOnScrollChangeListener(View.OnScrollChangeListener arg0)
void setOnSystemUiVisibilityChangeListener(View.OnSystemUiVisibilityChangeListener arg0)
void setOnTouchListener(View.OnTouchListener arg0)
void setOutlineAmbientShadowColor(int arg0)
void setOutlineProvider(ViewOutlineProvider arg0)
void setOutlineSpotShadowColor(int arg0)
void setOverScrollMode(int arg0)
void setPadding(int arg0, int arg1, int arg2, int arg3)
void setPaddingRelative(int arg0, int arg1, int arg2, int arg3)
void setPivotX(float arg0)
void setPivotY(float arg0)
void setPointerIcon(PointerIcon arg0)
final void setPreferKeepClear(boolean arg0)
final void setPreferKeepClearRects(List<Rect> arg0)
void setPressed(boolean arg0)
void setRenderEffect(RenderEffect arg0)
final void setRevealOnFocusHint(boolean arg0)
final void setRight(int arg0)
void setRotation(float arg0)
void setRotationX(float arg0)
void setRotationY(float arg0)
void setSaveEnabled(boolean arg0)
void setSaveFromParentEnabled(boolean arg0)
void setScaleX(float arg0)
void setScaleY(float arg0)
void setScreenReaderFocusable(boolean arg0)
void setScrollBarDefaultDelayBeforeFade(int arg0)
void setScrollBarFadeDuration(int arg0)
void setScrollBarSize(int arg0)
void setScrollBarStyle(int arg0)
final void setScrollCaptureCallback(ScrollCaptureCallback arg0)
void setScrollCaptureHint(int arg0)
void setScrollContainer(boolean arg0)
void setScrollIndicators(int arg0, int arg1)
void setScrollIndicators(int arg0)
void setScrollX(int arg0)
void setScrollY(int arg0)
void setScrollbarFadingEnabled(boolean arg0)
void setSelected(boolean arg0)
void setSoundEffectsEnabled(boolean arg0)
void setStateDescription(CharSequence arg0)
void setStateListAnimator(StateListAnimator arg0)
void setSystemGestureExclusionRects(List<Rect> arg0)
void setSystemUiVisibility(int arg0)
void setTag(int arg0, Object arg1)
void setTag(Object arg0)
void setTextAlignment(int arg0)
void setTextDirection(int arg0)
void setTooltipText(CharSequence arg0)
final void setTop(int arg0)
void setTouchDelegate(TouchDelegate arg0)
void setTransitionAlpha(float arg0)
final void setTransitionName(String arg0)
void setTransitionVisibility(int arg0)
void setTranslationX(float arg0)
void setTranslationY(float arg0)
void setTranslationZ(float arg0)
void setVerticalFadingEdgeEnabled(boolean arg0)
void setVerticalScrollBarEnabled(boolean arg0)
void setVerticalScrollbarPosition(int arg0)
void setVerticalScrollbarThumbDrawable(Drawable arg0)
void setVerticalScrollbarTrackDrawable(Drawable arg0)
void setViewTranslationCallback(ViewTranslationCallback arg0)
void setVisibility(int arg0)
void setWillNotCacheDrawing(boolean arg0)
void setWillNotDraw(boolean arg0)
void setWindowInsetsAnimationCallback(WindowInsetsAnimation.Callback arg0)
void setX(float arg0)
void setY(float arg0)
void setZ(float arg0)
boolean showContextMenu()
boolean showContextMenu(float arg0, float arg1)
ActionMode startActionMode(ActionMode.Callback arg0, int arg1)
ActionMode startActionMode(ActionMode.Callback arg0)
void startAnimation(Animation arg0)
final boolean startDrag(ClipData arg0, View.DragShadowBuilder arg1, Object arg2, int arg3)
final boolean startDragAndDrop(ClipData arg0, View.DragShadowBuilder arg1, Object arg2, int arg3)
boolean startNestedScroll(int arg0)
void stopNestedScroll()
String toString()
void transformMatrixToGlobal(Matrix arg0)
void transformMatrixToLocal(Matrix arg0)
void unscheduleDrawable(Drawable arg0, Runnable arg1)
void unscheduleDrawable(Drawable arg0)
final void updateDragShadow(View.DragShadowBuilder arg0)
boolean verifyDrawable(Drawable arg0)
boolean willNotCacheDrawing()
boolean willNotDraw()
Object clone()
boolean equals(Object arg0)
void finalize()
final Class<?> getClass()
int hashCode()
final void notify()
final void notifyAll()
String toString()
final void wait(long arg0, int arg1)
final void wait(long arg0)
final void wait()
abstract void bringChildToFront(View arg0)
abstract boolean canResolveLayoutDirection()
abstract boolean canResolveTextAlignment()
abstract boolean canResolveTextDirection()
abstract void childDrawableStateChanged(View arg0)
abstract void childHasTransientStateChanged(View arg0, boolean arg1)
abstract void clearChildFocus(View arg0)
abstract void createContextMenu(ContextMenu arg0)
default OnBackInvokedDispatcher findOnBackInvokedDispatcherForChild(View arg0, View arg1)
abstract View focusSearch(View arg0, int arg1)
abstract void focusableViewAvailable(View arg0)
abstract boolean getChildVisibleRect(View arg0, Rect arg1, Point arg2)
abstract int getLayoutDirection()
abstract ViewParent getParent()
abstract ViewParent getParentForAccessibility()
abstract int getTextAlignment()
abstract int getTextDirection()
abstract void invalidateChild(View arg0, Rect arg1)
abstract ViewParent invalidateChildInParent(int[] arg0, Rect arg1)
abstract boolean isLayoutDirectionResolved()
abstract boolean isLayoutRequested()
abstract boolean isTextAlignmentResolved()
abstract boolean isTextDirectionResolved()
abstract View keyboardNavigationClusterSearch(View arg0, int arg1)
abstract void notifySubtreeAccessibilityStateChanged(View arg0, View arg1, int arg2)
default void onDescendantInvalidated(View arg0, View arg1)
abstract boolean onNestedFling(View arg0, float arg1, float arg2, boolean arg3)
abstract boolean onNestedPreFling(View arg0, float arg1, float arg2)
abstract boolean onNestedPrePerformAccessibilityAction(View arg0, int arg1, Bundle arg2)
abstract void onNestedPreScroll(View arg0, int arg1, int arg2, int[] arg3)
abstract void onNestedScroll(View arg0, int arg1, int arg2, int arg3, int arg4)
abstract void onNestedScrollAccepted(View arg0, View arg1, int arg2)
abstract boolean onStartNestedScroll(View arg0, View arg1, int arg2)
abstract void onStopNestedScroll(View arg0)
abstract void recomputeViewAttributes(View arg0)
abstract void requestChildFocus(View arg0, View arg1)
abstract boolean requestChildRectangleOnScreen(View arg0, Rect arg1, boolean arg2)
abstract void requestDisallowInterceptTouchEvent(boolean arg0)
abstract void requestFitSystemWindows()
abstract void requestLayout()
abstract boolean requestSendAccessibilityEvent(View arg0, AccessibilityEvent arg1)
abstract void requestTransparentRegion(View arg0)
abstract boolean showContextMenuForChild(View arg0)
abstract boolean showContextMenuForChild(View arg0, float arg1, float arg2)
abstract ActionMode startActionModeForChild(View arg0, ActionMode.Callback arg1, int arg2)
abstract ActionMode startActionModeForChild(View arg0, ActionMode.Callback arg1)
abstract void addView(View arg0, ViewGroup.LayoutParams arg1)
abstract void removeView(View arg0)
abstract void updateViewLayout(View arg0, ViewGroup.LayoutParams arg1)
abstract void invalidateDrawable(Drawable arg0)
abstract void scheduleDrawable(Drawable arg0, Runnable arg1, long arg2)
abstract void unscheduleDrawable(Drawable arg0, Runnable arg1)
abstract boolean onKeyDown(int arg0, KeyEvent arg1)
abstract boolean onKeyLongPress(int arg0, KeyEvent arg1)
abstract boolean onKeyMultiple(int arg0, int arg1, KeyEvent arg2)
abstract boolean onKeyUp(int arg0, KeyEvent arg1)
abstract void sendAccessibilityEvent(int arg0)
abstract void sendAccessibilityEventUnchecked(AccessibilityEvent arg0)

XML attributes

TabLayout_tabBackground

TabLayout_tabContentStart

TabLayout_tabGravity

Related methods:

TabLayout_tabIndicatorAnimationMode

Related methods:

TabLayout_tabIndicatorColor

Related methods:

TabLayout_tabIndicatorFullWidth

Related methods:

TabLayout_tabIndicatorGravity

Related methods:

TabLayout_tabIndicatorHeight

Related methods:

TabLayout_tabInlineLabel

Related methods:

TabLayout_tabMaxWidth

TabLayout_tabMinWidth

TabLayout_tabMode

Related methods:

TabLayout_tabPadding

TabLayout_tabPaddingBottom

TabLayout_tabPaddingEnd

TabLayout_tabPaddingStart

TabLayout_tabPaddingTop

TabLayout_tabRippleColor

Related methods:

TabLayout_tabSelectedTextColor

Related methods:

TabLayout_tabTextAppearance

TabLayout_tabTextColor

Related methods:

TabLayout_tabUnboundedRipple

Related methods:

Constants

GRAVITY_CENTER

public static final int GRAVITY_CENTER

Gravity used to lay out the tabs in the center of the TabLayout.

Constant Value: 1 (0x00000001)

GRAVITY_FILL

public static final int GRAVITY_FILL

Gravity used to fill the TabLayout as much as possible. This option only takes effect when used with MODE_FIXED on non-landscape screens less than 600dp wide.

Constant Value: 0 (0x00000000)

GRAVITY_START

public static final int GRAVITY_START

Gravity used to lay out the tabs aligned to the start of the TabLayout.

Constant Value: 2 (0x00000002)

INDICATOR_ANIMATION_MODE_ELASTIC

public static final int INDICATOR_ANIMATION_MODE_ELASTIC

Indicator animation mode used to translate the selected tab indicator by growing and then shrinking the indicator, making the indicator look like it is stretching while translating between destinations.

The left and right side of the selection indicator translate out of step - with the right decelerating and the left accelerating (when moving right). This difference in velocity between the sides of the indicator, over the duration of the animation, make the indicator look like it grows and then shrinks back down to fit it's new destination's width.

Constant Value: 1 (0x00000001)

INDICATOR_ANIMATION_MODE_FADE

public static final int INDICATOR_ANIMATION_MODE_FADE

Indicator animation mode used to switch the selected tab indicator from one tab to another by sequentially fading it out from the current destination and in at its new destination.

Constant Value: 2 (0x00000002)

INDICATOR_ANIMATION_MODE_LINEAR

public static final int INDICATOR_ANIMATION_MODE_LINEAR

Indicator animation mode used to translate the selected tab indicator between two tabs using a linear motion.

The left and right side of the selection indicator translate in step over the duration of the animation. The only exception to this is when the indicator needs to change size to fit the width of its new destination tab's label.

Constant Value: 0 (0x00000000)

INDICATOR_GRAVITY_BOTTOM

public static final int INDICATOR_GRAVITY_BOTTOM

Indicator gravity used to align the tab selection indicator to the bottom of the TabLayout. This will only take effect if the indicator height is set via the custom indicator drawable's intrinsic height (preferred), via the tabIndicatorHeight attribute (deprecated), or via setSelectedTabIndicatorHeight(int) (deprecated). Otherwise, the indicator will not be shown. This is the default value.

Constant Value: 0 (0x00000000)

INDICATOR_GRAVITY_CENTER

public static final int INDICATOR_GRAVITY_CENTER

Indicator gravity used to align the tab selection indicator to the center of the TabLayout. This will only take effect if the indicator height is set via the custom indicator drawable's intrinsic height (preferred), via the tabIndicatorHeight attribute (deprecated), or via setSelectedTabIndicatorHeight(int) (deprecated). Otherwise, the indicator will not be shown.

Constant Value: 1 (0x00000001)

INDICATOR_GRAVITY_STRETCH

public static final int INDICATOR_GRAVITY_STRETCH

Indicator gravity used to stretch the tab selection indicator across the entire height of the TabLayout. This will disregard tabIndicatorHeight and the indicator drawable's intrinsic height, if set.

Constant Value: 3 (0x00000003)

INDICATOR_GRAVITY_TOP

public static final int INDICATOR_GRAVITY_TOP

Indicator gravity used to align the tab selection indicator to the top of the TabLayout. This will only take effect if the indicator height is set via the custom indicator drawable's intrinsic height (preferred), via the tabIndicatorHeight attribute (deprecated), or via setSelectedTabIndicatorHeight(int) (deprecated). Otherwise, the indicator will not be shown.

Constant Value: 2 (0x00000002)

MODE_AUTO

public static final int MODE_AUTO

Auto-sizing tabs behave like MODE_FIXED with GRAVITY_CENTER while the tabs fit within the TabLayout's content width. Fixed tabs have equal width, based on the widest tab label. Once the tabs outgrow the view's width, auto-sizing tabs behave like MODE_SCROLLABLE, allowing for a dynamic number of tabs without requiring additional layout logic.

Constant Value: 2 (0x00000002)

MODE_FIXED

public static final int MODE_FIXED

Fixed tabs display all tabs concurrently and are best used with content that benefits from quick pivots between tabs. The maximum number of tabs is limited by the view's width. Fixed tabs have equal width, based on the widest tab label.

Constant Value: 1 (0x00000001)

MODE_SCROLLABLE

public static final int MODE_SCROLLABLE

Scrollable tabs display a subset of tabs at any given moment, and can contain longer tab labels and a larger number of tabs. They are best used for browsing contexts in touch interfaces when users don't need to directly compare the tab labels.

Constant Value: 0 (0x00000000)

TAB_LABEL_VISIBILITY_LABELED

public static final int TAB_LABEL_VISIBILITY_LABELED

This mode is set by default. If a tab is instantiated with TabLayout.Tab.setText(CharSequence), a visible label will be created.

Constant Value: 1 (0x00000001)

TAB_LABEL_VISIBILITY_UNLABELED

public static final int TAB_LABEL_VISIBILITY_UNLABELED

If a tab is instantiated with TabLayout.Tab.setText(CharSequence), and this mode is set, the text will be saved and utilized for the content description, but no visible labels will be created.

Constant Value: 0 (0x00000000)

Public constructors

TabLayout

public TabLayout (Context context)

Parameters
context Context

TabLayout

public TabLayout (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

TabLayout

public TabLayout (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

addOnTabSelectedListener

public void addOnTabSelectedListener (TabLayout.OnTabSelectedListener listener)

Add a TabLayout.OnTabSelectedListener that will be invoked when tab selection changes.

Components that add a listener should take care to remove it when finished via removeOnTabSelectedListener(OnTabSelectedListener).

Parameters
listener TabLayout.OnTabSelectedListener: listener to add

addOnTabSelectedListener

public void addOnTabSelectedListener (BaseOnTabSelectedListener listener)

This method is deprecated.
use addOnTabSelectedListener(OnTabSelectedListener)

Add a TabLayout.BaseOnTabSelectedListener that will be invoked when tab selection changes.

Components that add a listener should take care to remove it when finished via removeOnTabSelectedListener(BaseOnTabSelectedListener).

Parameters
listener BaseOnTabSelectedListener: listener to add

addTab

public void addTab (TabLayout.Tab tab)

Add a tab to this layout. The tab will be added at the end of the list. If this is the first tab to be added it will become the selected tab.

Parameters
tab TabLayout.Tab: Tab to add

addTab

public void addTab (TabLayout.Tab tab, 
                boolean setSelected)

Add a tab to this layout. The tab will be added at the end of the list.

Parameters
tab TabLayout.Tab: Tab to add

setSelected boolean: True if the added tab should become the selected tab.

addTab

public void addTab (TabLayout.Tab tab, 
                int position)

Add a tab to this layout. The tab will be inserted at position. If this is the first tab to be added it will become the selected tab.

Parameters
tab TabLayout.Tab: The tab to add

position int: The new position of the tab

addTab

public void addTab (TabLayout.Tab tab, 
                int position, 
                boolean setSelected)

Add a tab to this layout. The tab will be inserted at position.

Parameters
tab TabLayout.Tab: The tab to add

position int: The new position of the tab

setSelected boolean: True if the added tab should become the selected tab.

addView

public void addView (View child, 
                int index)

Parameters
child View

index int

addView

public void addView (View child, 
                ViewGroup.LayoutParams params)

Parameters
child View

params ViewGroup.LayoutParams

addView

public void addView (View child, 
                int index, 
                ViewGroup.LayoutParams params)

Parameters
child View

index int

params ViewGroup.LayoutParams

addView

public void addView (View child)

Parameters
child View

clearOnTabSelectedListeners

public void clearOnTabSelectedListeners ()

Remove all previously added TabLayout.OnTabSelectedListeners.

generateLayoutParams

public FrameLayout.LayoutParams generateLayoutParams (AttributeSet attrs)

Parameters
attrs AttributeSet

Returns
FrameLayout.LayoutParams

getSelectedTabPosition

public int getSelectedTabPosition ()

Returns the position of the current selected tab.

Returns
int selected tab position, or -1 if there isn't a selected tab.

getTabAt

public TabLayout.Tab getTabAt (int index)

Returns the tab at the specified index.

Parameters
index int

Returns
TabLayout.Tab

getTabCount

public int getTabCount ()

Returns the number of tabs currently registered with the tab layout.

Returns
int Tab count

getTabGravity

public int getTabGravity ()

The current gravity used for laying out tabs.

Returns
int one of GRAVITY_CENTER or GRAVITY_FILL.

getTabIconTint

public ColorStateList getTabIconTint ()

Gets the icon tint for the different states (normal, selected) used for the tabs.

Returns
ColorStateList

getTabIndicatorAnimationMode

public int getTabIndicatorAnimationMode ()

Get the current indicator animation mode used to animate the selection indicator between destinations.

Related XML Attributes:

getTabIndicatorGravity

public int getTabIndicatorGravity ()

Get the current indicator gravity used to align the tab selection indicator in the TabLayout.

getTabMode

public int getTabMode ()

Returns the current mode used by this TabLayout.

Returns
int

See also:

getTabRippleColor

public ColorStateList getTabRippleColor ()

Returns the ripple color for this TabLayout.

Returns
ColorStateList the color (or ColorStateList) used for the ripple

getTabSelectedIndicator

public Drawable getTabSelectedIndicator ()

Returns the selection indicator drawable for this TabLayout.

Returns
Drawable The drawable used as the tab selection indicator, if set.

getTabTextColors

public ColorStateList getTabTextColors ()

Gets the text colors for the different states (normal, selected) used for the tabs.

Returns
ColorStateList

hasUnboundedRipple

public boolean hasUnboundedRipple ()

Returns whether this TabLayout has an unbounded ripple effect, or if ripple is bound to the tab item size.

Related XML Attributes:

Returns
boolean

isInlineLabel

public boolean isInlineLabel ()

Returns whether tab labels will be displayed inline with tab icons, or if they will be displayed underneath tab icons.

Related XML Attributes:

Returns
boolean

isTabIndicatorFullWidth

public boolean isTabIndicatorFullWidth ()

Get whether or not selection indicator width is fit to full width of the tab item, or fit to the tab item's content.

Related XML Attributes:

Returns
boolean whether or not selection indicator width is fit to the full width of the tab item

newTab

public TabLayout.Tab newTab ()

Create and return a new TabLayout.Tab. You need to manually add this using addTab(Tab) or a related method.

Returns
TabLayout.Tab A new Tab

See also:

onInitializeAccessibilityNodeInfo

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

Parameters
info AccessibilityNodeInfo

onInterceptTouchEvent

public boolean onInterceptTouchEvent (MotionEvent event)

Parameters
event MotionEvent

Returns
boolean

onTouchEvent

public boolean onTouchEvent (MotionEvent event)

Parameters
event MotionEvent

Returns
boolean

removeAllTabs

public void removeAllTabs ()

Remove all tabs from the tab layout and deselect the current tab.

removeOnTabSelectedListener

public void removeOnTabSelectedListener (TabLayout.OnTabSelectedListener listener)

Remove the given TabLayout.OnTabSelectedListener that was previously added via addOnTabSelectedListener(OnTabSelectedListener).

Parameters
listener TabLayout.OnTabSelectedListener: listener to remove

removeOnTabSelectedListener

public void removeOnTabSelectedListener (BaseOnTabSelectedListener listener)

This method is deprecated.
use removeOnTabSelectedListener(OnTabSelectedListener)

Remove the given TabLayout.BaseOnTabSelectedListener that was previously added via addOnTabSelectedListener(BaseOnTabSelectedListener).

Parameters
listener BaseOnTabSelectedListener: listener to remove

removeTab

public void removeTab (TabLayout.Tab tab)

Remove a tab from the layout. If the removed tab was selected it will be deselected and another tab will be selected if present.

Parameters
tab TabLayout.Tab: The tab to remove

removeTabAt

public void removeTabAt (int position)

Remove a tab from the layout. If the removed tab was selected it will be deselected and another tab will be selected if present.

Parameters
position int: Position of the tab to remove

selectTab

public void selectTab (TabLayout.Tab tab)

Selects the given tab.

Parameters
tab TabLayout.Tab: The tab to select, or null to select none.

selectTab

public void selectTab (TabLayout.Tab tab, 
                boolean updateIndicator)

Selects the given tab. Will always animate to the selected tab if the current tab is reselected, regardless of the value of updateIndicator.

Parameters
tab TabLayout.Tab: The tab to select, or null to select none.

updateIndicator boolean: Whether to update the indicator.

See also:

setElevation

public void setElevation (float elevation)

Parameters
elevation float

setInlineLabel

public void setInlineLabel (boolean inline)

Set whether tab labels will be displayed inline with tab icons, or if they will be displayed underneath tab icons.

Related XML Attributes:

Parameters
inline boolean

See also:

setInlineLabelResource

public void setInlineLabelResource (int inlineResourceId)

Set whether tab labels will be displayed inline with tab icons, or if they will be displayed underneath tab icons.

Related XML Attributes:

Parameters
inlineResourceId int: Resource ID for boolean inline flag

See also:

setOnTabSelectedListener

public void setOnTabSelectedListener (BaseOnTabSelectedListener listener)

This method is deprecated.
Use addOnTabSelectedListener(OnTabSelectedListener) and removeOnTabSelectedListener(OnTabSelectedListener).

Parameters
listener BaseOnTabSelectedListener

setOnTabSelectedListener

public void setOnTabSelectedListener (TabLayout.OnTabSelectedListener listener)

This method is deprecated.
Use addOnTabSelectedListener(OnTabSelectedListener) and removeOnTabSelectedListener(OnTabSelectedListener).

Parameters
listener TabLayout.OnTabSelectedListener

setScrollPosition

public void setScrollPosition (int position, 
                float positionOffset, 
                boolean updateSelectedTabView, 
                boolean updateIndicatorPosition)

Set the scroll position of the TabLayout.

Parameters
position int: Position of the tab to scroll.

positionOffset float: Value from [0, 1) indicating the offset from position.

updateSelectedTabView boolean: Whether to draw the tab at the specified position + positionOffset as selected.

Note that calling the method with updateSelectedTabView = true does not select a tab at the specified position, but only draws it as selected. This can be useful for when the TabLayout behavior needs to be linked to another view, such as ViewPager.

updateIndicatorPosition boolean: Whether to set the indicator to the specified position and offset.

Note that calling the method with updateIndicatorPosition = true does not select a tab at the specified position, but only updates the indicator position. This can be useful for when the TabLayout behavior needs to be linked to another view, such as ViewPager.

setScrollPosition

public void setScrollPosition (int position, 
                float positionOffset, 
                boolean updateSelectedTabView)

Set the scroll position of the TabLayout.

Parameters
position int: Position of the tab to scroll.

positionOffset float: Value from [0, 1) indicating the offset from position.

updateSelectedTabView boolean: Whether to draw the tab at the specified position + positionOffset as selected.

Note that calling the method with updateSelectedTabView = true does not select a tab at the specified position, but only draws it as selected. This can be useful for when the TabLayout behavior needs to be linked to another view, such as ViewPager.

setSelectedTabIndicator

public void setSelectedTabIndicator (Drawable tabSelectedIndicator)

Sets the selection indicator for this TabLayout. By default, this is a line along the bottom of the tab. If tabIndicatorColor is specified via the TabLayout's style or via setSelectedTabIndicatorColor(int) the selection indicator will be tinted that color. Otherwise, it will use the colors specified in the drawable.

Setting the indicator drawable to null will cause TabLayout to use the default, GradientDrawable line indicator.

Parameters
tabSelectedIndicator Drawable: A drawable to use as the selected tab indicator.

setSelectedTabIndicator

public void setSelectedTabIndicator (int tabSelectedIndicatorResourceId)

Sets the drawable resource to use as the selection indicator for this TabLayout. By default, this is a line along the bottom of the tab. If tabIndicatorColor is specified via the TabLayout's style or via setSelectedTabIndicatorColor(int) the selection indicator will be tinted that color. Otherwise, it will use the colors specified in the drawable.

Parameters
tabSelectedIndicatorResourceId int: A drawable resource to use as the selected tab indicator.

setSelectedTabIndicatorColor

public void setSelectedTabIndicatorColor (int color)

Sets the tab indicator's color for the currently selected tab.

If the tab indicator color is not Color.TRANSPARENT, the indicator will be wrapped and tinted right before it is drawn by ERROR(/SlidingTabIndicator#draw(Canvas)). If you'd like the inherent color or the tinted color of a custom drawable to be used, make sure this color is set to Color.TRANSPARENT to avoid your color/tint being overridden.

Related XML Attributes:

Parameters
color int: color to use for the indicator

setSelectedTabIndicatorGravity

public void setSelectedTabIndicatorGravity (int indicatorGravity)

Set the indicator gravity used to align the tab selection indicator in the TabLayout. You must set the indicator height via the custom indicator drawable's intrinsic height (preferred), via the tabIndicatorHeight attribute (deprecated), or via setSelectedTabIndicatorHeight(int) (deprecated). Otherwise, the indicator will not be shown unless gravity is set to INDICATOR_GRAVITY_STRETCH, in which case it will ignore indicator height and stretch across the entire height of the TabLayout. This defaults to INDICATOR_GRAVITY_BOTTOM if not set.

Related XML Attributes:

setSelectedTabIndicatorHeight

public void setSelectedTabIndicatorHeight (int height)

This method is deprecated.
If possible, set the intrinsic height directly on a custom indicator drawable passed to setSelectedTabIndicator(Drawable).

Sets the tab indicator's height for the currently selected tab.

Related XML Attributes:

Parameters
height int: height to use for the indicator in pixels

setTabGravity

public void setTabGravity (int gravity)

Set the gravity to use when laying out the tabs.

Related XML Attributes:

Parameters
gravity int: one of GRAVITY_CENTER or GRAVITY_FILL.

setTabIconTint

public void setTabIconTint (ColorStateList iconTint)

Sets the icon tint for the different states (normal, selected) used for the tabs.

Parameters
iconTint ColorStateList

See also:

setTabIconTintResource

public void setTabIconTintResource (int iconTintResourceId)

Sets the icon tint resource for the different states (normal, selected) used for the tabs.

Parameters
iconTintResourceId int: A color resource to use as icon tint.

See also:

setTabIndicatorAnimationMode

public void setTabIndicatorAnimationMode (int tabIndicatorAnimationMode)

Set the mode by which the selection indicator should animate when moving between destinations.

Defaults to INDICATOR_ANIMATION_MODE_LINEAR. Changing this is useful as a stylistic choice.

Related XML Attributes:

Parameters
tabIndicatorAnimationMode int: one of INDICATOR_ANIMATION_MODE_LINEAR or INDICATOR_ANIMATION_MODE_ELASTIC

setTabIndicatorFullWidth

public void setTabIndicatorFullWidth (boolean tabIndicatorFullWidth)

Enable or disable option to fit the tab selection indicator to the full width of the tab item rather than to the tab item's content.

Defaults to true. If set to false and the tab item has a text label, the selection indicator width will be set to the width of the text label. If the tab item has no text label, but does have an icon, the selection indicator width will be set to the icon. If the tab item has neither of these, or if the calculated width is less than a minimum width value, the selection indicator width will be set to the minimum width value.

Related XML Attributes:

Parameters
tabIndicatorFullWidth boolean: Whether or not to fit selection indicator width to full width of the tab item

setTabMode

public void setTabMode (int mode)

Set the behavior mode for the Tabs in this layout. The valid input options are:

  • MODE_FIXED: Fixed tabs display all tabs concurrently and are best used with content that benefits from quick pivots between tabs.
  • MODE_SCROLLABLE: Scrollable tabs display a subset of tabs at any given moment, and can contain longer tab labels and a larger number of tabs. They are best used for browsing contexts in touch interfaces when users don't need to directly compare the tab labels. This mode is commonly used with a ViewPager.

Related XML Attributes:

Parameters
mode int: one of MODE_FIXED or MODE_SCROLLABLE.

setTabRippleColor

public void setTabRippleColor (ColorStateList color)

Sets the ripple color for this TabLayout.

When running on devices with KitKat or below, we draw this color as a filled overlay rather than a ripple.

Related XML Attributes:

Parameters
color ColorStateList: color (or ColorStateList) to use for the ripple

setTabRippleColorResource

public void setTabRippleColorResource (int tabRippleColorResourceId)

Sets the ripple color resource for this TabLayout.

When running on devices with KitKat or below, we draw this color as a filled overlay rather than a ripple.

Parameters
tabRippleColorResourceId int: A color resource to use as ripple color.

setTabTextColors

public void setTabTextColors (int normalColor, 
                int selectedColor)

Sets the text colors for the different states (normal, selected) used for the tabs.

Related XML Attributes:

Parameters
normalColor int

selectedColor int

setTabTextColors

public void setTabTextColors (ColorStateList textColor)

Sets the text colors for the different states (normal, selected) used for the tabs.

Parameters
textColor ColorStateList

See also:

setTabsFromPagerAdapter

public void setTabsFromPagerAdapter (PagerAdapter adapter)

This method is deprecated.
Use setupWithViewPager(ViewPager) to link a TabLayout with a ViewPager together. When that method is used, the TabLayout will be automatically updated when the PagerAdapter is changed.

Parameters
adapter PagerAdapter

setUnboundedRipple

public void setUnboundedRipple (boolean unboundedRipple)

Set whether this TabLayout will have an unbounded ripple effect or if ripple will be bound to the tab item size.

Defaults to false.

Related XML Attributes:

Parameters
unboundedRipple boolean

setUnboundedRippleResource

public void setUnboundedRippleResource (int unboundedRippleResourceId)

Set whether this TabLayout will have an unbounded ripple effect or if ripple will be bound to the tab item size. Defaults to false.

Related XML Attributes:

Parameters
unboundedRippleResourceId int: Resource ID for boolean unbounded ripple value

setupWithViewPager

public void setupWithViewPager (ViewPager viewPager)

The one-stop shop for setting up this TabLayout with a ViewPager.

This is the same as calling setupWithViewPager(ViewPager, boolean) with auto-refresh enabled.

Parameters
viewPager ViewPager: the ViewPager to link to, or null to clear any previous link

setupWithViewPager

public void setupWithViewPager (ViewPager viewPager, 
                boolean autoRefresh)

The one-stop shop for setting up this TabLayout with a ViewPager.

This method will link the given ViewPager and this TabLayout together so that changes in one are automatically reflected in the other. This includes scroll state changes and clicks. The tabs displayed in this layout will be populated from the ViewPager adapter's page titles.

If autoRefresh is true, any changes in the PagerAdapter will trigger this layout to re-populate itself from the adapter's titles.

If the given ViewPager is non-null, it needs to already have a PagerAdapter set.

Parameters
viewPager ViewPager: the ViewPager to link to, or null to clear any previous link

autoRefresh boolean: whether this layout should refresh its contents if the given ViewPager's content changes

shouldDelayChildPressedState

public boolean shouldDelayChildPressedState ()

Returns
boolean

Protected methods

createTabFromPool

protected TabLayout.Tab createTabFromPool ()

Returns
TabLayout.Tab

onAttachedToWindow

protected void onAttachedToWindow ()

onDetachedFromWindow

protected void onDetachedFromWindow ()

onDraw

protected void onDraw (Canvas canvas)

Parameters
canvas Canvas

onMeasure

protected void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int

releaseFromTabPool

protected boolean releaseFromTabPool (TabLayout.Tab tab)

Parameters
tab TabLayout.Tab

Returns
boolean