Added in API level 11
Deprecated in API level 21

Tab

abstract class Tab
kotlin.Any
   ↳ android.app.ActionBar.Tab

A tab in the action bar.

Tabs manage the hiding and showing of Fragments.

Summary

Constants
static Int

An invalid position for a tab.

Public constructors
Tab()

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!

Return the icon associated with this tab.

abstract Int

Return the current position of this tab in the action bar.

abstract Any!

abstract CharSequence!

Return the text of this tab.

abstract Unit

Select this tab.

abstract ActionBar.Tab!

Set a description of this tab's content for use in accessibility support.

abstract ActionBar.Tab!

Set a description of this tab's content for use in accessibility support.

abstract ActionBar.Tab!

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!
setIcon(icon: Drawable!)

Set the icon displayed on this tab.

abstract ActionBar.Tab!
setIcon(resId: Int)

Set the icon displayed on this tab.

abstract ActionBar.Tab!

Set the TabListener that will handle switching to and from this tab.

abstract ActionBar.Tab!
setTag(obj: Any!)

Give this Tab an arbitrary object to hold for later use.

abstract ActionBar.Tab!

Set the text displayed on this tab.

abstract ActionBar.Tab!
setText(resId: Int)

Set the text displayed on this tab.

Constants

INVALID_POSITION

Added in API level 11
static val INVALID_POSITION: Int

Deprecated: Deprecated in Java.

An invalid position for a tab.

Value: -1

See Also

Public constructors

Tab

Tab()

Public methods

getContentDescription

Added in API level 14
Deprecated in API level 21
abstract fun getContentDescription(): CharSequence!

Deprecated: Deprecated in Java.

Gets a brief description of this tab's content for use in accessibility support.

Return
CharSequence! Description of this tab's content

getCustomView

Added in API level 11
abstract fun getCustomView(): View!

Deprecated: Deprecated in Java.

Retrieve a previously set custom view for this tab.

Return
View! The custom view set by setCustomView(android.view.View).

getIcon

Added in API level 11
abstract fun getIcon(): Drawable!

Deprecated: Deprecated in Java.

Return the icon associated with this tab.

Return
Drawable! The tab's icon

getPosition

Added in API level 11
abstract fun getPosition(): Int

Deprecated: Deprecated in Java.

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.

getTag

Added in API level 11
abstract fun getTag(): Any!

Deprecated: Deprecated in Java.

Return
Any! This Tab's tag object.

getText

Added in API level 11
abstract fun getText(): CharSequence!

Deprecated: Deprecated in Java.

Return the text of this tab.

Return
CharSequence! The tab's text

select

Added in API level 11
abstract fun select(): Unit

Deprecated: Deprecated in Java.

Select this tab. Only valid if the tab has been added to the action bar.

setContentDescription

Added in API level 14
Deprecated in API level 21
abstract fun setContentDescription(resId: Int): ActionBar.Tab!

Deprecated: Deprecated in Java.

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

Added in API level 14
Deprecated in API level 21
abstract fun setContentDescription(contentDesc: CharSequence!): ActionBar.Tab!

Deprecated: Deprecated in Java.

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

Added in API level 11
abstract fun setCustomView(view: View!): ActionBar.Tab!

Deprecated: Deprecated in Java.

Set a custom view to be used for this tab. This overrides values set by setText(java.lang.CharSequence) and setIcon(android.graphics.drawable.Drawable).

Parameters
view View!: Custom view to be used as a tab.
Return
ActionBar.Tab! The current instance for call chaining

setCustomView

Added in API level 11
abstract fun setCustomView(layoutResId: Int): ActionBar.Tab!

Deprecated: Deprecated in Java.

Set a custom view to be used for this tab. This overrides values set by setText(java.lang.CharSequence) and setIcon(android.graphics.drawable.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

Added in API level 11
abstract fun setIcon(icon: Drawable!): ActionBar.Tab!

Deprecated: Deprecated in Java.

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

Added in API level 11
abstract fun setIcon(resId: Int): ActionBar.Tab!

Deprecated: Deprecated in Java.

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

Added in API level 11
abstract fun setTabListener(listener: ActionBar.TabListener!): ActionBar.Tab!

Deprecated: Deprecated in Java.

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

Added in API level 11
abstract fun setTag(obj: Any!): ActionBar.Tab!

Deprecated: Deprecated in Java.

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

Added in API level 11
abstract fun setText(text: CharSequence!): ActionBar.Tab!

Deprecated: Deprecated in Java.

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

Added in API level 11
abstract fun setText(resId: Int): ActionBar.Tab!

Deprecated: Deprecated in Java.

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