Tab
abstract classTab
kotlin.Any | |
↳ | androidx.appcompat.app.ActionBar.Tab |
A tab in the action bar.
Tabs manage the hiding and showing of Fragment
s.
Summary
Constants | |
---|---|
static Int |
An invalid position for a tab. |
Public constructors | |
---|---|
<init>() A tab in the action bar. |
Public methods | |
---|---|
abstract CharSequence! |
Gets a brief description of this tab's content for use in accessibility support. |
abstract View! |
Retrieve a previously set custom view for this tab. |
abstract Drawable! |
getIcon() Return the icon associated with this tab. |
abstract Int |
Return the current position of this tab in the action bar. |
abstract Any! |
getTag() |
abstract CharSequence! |
getText() Return the text of this tab. |
abstract Unit |
select() Select this tab. |
abstract ActionBar.Tab! |
setContentDescription(@StringRes resId: Int) Set a description of this tab's content for use in accessibility support. |
abstract ActionBar.Tab! |
setContentDescription(contentDesc: CharSequence!) Set a description of this tab's content for use in accessibility support. |
abstract ActionBar.Tab! |
setCustomView(view: View!) Set a custom view to be used for this tab. |
abstract ActionBar.Tab! |
setCustomView(layoutResId: Int) Set a custom view to be used for this tab. |
abstract ActionBar.Tab! |
Set the icon displayed on this tab. |
abstract ActionBar.Tab! |
Set the icon displayed on this tab. |
abstract ActionBar.Tab! |
setTabListener(listener: ActionBar.TabListener!) Set the |
abstract ActionBar.Tab! |
Give this Tab an arbitrary object to hold for later use. |
abstract ActionBar.Tab! |
setText(text: CharSequence!) Set the text displayed on this tab. |
abstract ActionBar.Tab! |
Set the text displayed on this tab. |
Constants
Public constructors
<init>
Tab()
Deprecated: Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.
A tab in the action bar.
Tabs manage the hiding and showing of Fragment
s.
Public methods
getContentDescription
abstract fun getContentDescription(): CharSequence!
Gets a brief description of this tab's content for use in accessibility support.
Return | |
---|---|
CharSequence! |
Description of this tab's content |
getCustomView
abstract fun getCustomView(): View!
Retrieve a previously set custom view for this tab.
Return | |
---|---|
View! |
The custom view set by setCustomView(View) . |
getIcon
abstract fun getIcon(): Drawable!
Return the icon associated with this tab.
Return | |
---|---|
Drawable! |
The tab's icon |
getPosition
abstract fun getPosition(): Int
Return the current position of this tab in the action bar.
Return | |
---|---|
Int |
Current position, or INVALID_POSITION if this tab is not currently in the action bar. |
getText
abstract fun getText(): CharSequence!
Return the text of this tab.
Return | |
---|---|
CharSequence! |
The tab's text |
select
abstract fun select(): Unit
Select this tab. Only valid if the tab has been added to the action bar.
setContentDescription
abstract fun setContentDescription(@StringRes resId: Int): ActionBar.Tab!
Set a description of this tab's content for use in accessibility support. If no content description is provided the title will be used.
Parameters | |
---|---|
resId |
Int: A resource ID referring to the description text |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setContentDescription
abstract fun setContentDescription(contentDesc: CharSequence!): ActionBar.Tab!
Set a description of this tab's content for use in accessibility support. If no content description is provided the title will be used.
Parameters | |
---|---|
contentDesc |
CharSequence!: Description of this tab's content |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setCustomView
abstract fun setCustomView(view: View!): ActionBar.Tab!
Set a custom view to be used for this tab. This overrides values set by setText(CharSequence)
and setIcon(Drawable)
.
Parameters | |
---|---|
view |
View!: Custom view to be used as a tab. |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setCustomView
abstract fun setCustomView(layoutResId: Int): ActionBar.Tab!
Set a custom view to be used for this tab. This overrides values set by setText(CharSequence)
and setIcon(Drawable)
.
Parameters | |
---|---|
layoutResId |
Int: A layout resource to inflate and use as a custom tab view |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setIcon
abstract fun setIcon(icon: Drawable!): ActionBar.Tab!
Set the icon displayed on this tab.
Parameters | |
---|---|
icon |
Drawable!: The drawable to use as an icon |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setIcon
abstract fun setIcon(@DrawableRes resId: Int): ActionBar.Tab!
Set the icon displayed on this tab.
Parameters | |
---|---|
resId |
Int: Resource ID referring to the drawable to use as an icon |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setTabListener
abstract fun setTabListener(listener: ActionBar.TabListener!): ActionBar.Tab!
Set the TabListener
that will handle switching to and from this tab. All tabs must have a TabListener set before being added to the ActionBar.
Parameters | |
---|---|
listener |
ActionBar.TabListener!: Listener to handle tab selection events |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setTag
abstract fun setTag(obj: Any!): ActionBar.Tab!
Give this Tab an arbitrary object to hold for later use.
Parameters | |
---|---|
obj |
Any!: Object to store |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setText
abstract fun setText(text: CharSequence!): ActionBar.Tab!
Set the text displayed on this tab. Text may be truncated if there is not room to display the entire string.
Parameters | |
---|---|
text |
CharSequence!: The text to display |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |
setText
abstract fun setText(resId: Int): ActionBar.Tab!
Set the text displayed on this tab. Text may be truncated if there is not room to display the entire string.
Parameters | |
---|---|
resId |
Int: A resource ID referring to the text that should be displayed |
Return | |
---|---|
ActionBar.Tab! |
The current instance for call chaining |