public abstract class

ActionBar.Tab

extends java.lang.Object

 java.lang.Object

↳androidx.appcompat.app.ActionBar.Tab

Subclasses:

WindowDecorActionBar.TabImpl

Overview

A tab in the action bar.

Tabs manage the hiding and showing of Fragments.

Summary

Fields
public static final intINVALID_POSITION

An invalid position for a tab.

Constructors
publicTab()

Methods
public abstract java.lang.CharSequencegetContentDescription()

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

public abstract ViewgetCustomView()

Retrieve a previously set custom view for this tab.

public abstract DrawablegetIcon()

Return the icon associated with this tab.

public abstract intgetPosition()

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

public abstract java.lang.ObjectgetTag()

public abstract java.lang.CharSequencegetText()

Return the text of this tab.

public abstract voidselect()

Select this tab.

public abstract ActionBar.TabsetContentDescription(java.lang.CharSequence contentDesc)

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

public abstract ActionBar.TabsetContentDescription(int resId)

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

public abstract ActionBar.TabsetCustomView(View view)

Set a custom view to be used for this tab.

public abstract ActionBar.TabsetIcon(Drawable icon)

Set the icon displayed on this tab.

public abstract ActionBar.TabsetTabListener(ActionBar.TabListener listener)

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

public abstract ActionBar.TabsetTag(java.lang.Object obj)

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

public abstract ActionBar.TabsetText(java.lang.CharSequence text)

Set the text displayed on this tab.

public abstract ActionBar.TabsetText(int resId)

Set the text displayed on this tab.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final int INVALID_POSITION

An invalid position for a tab.

See also: ActionBar.Tab.getPosition()

Constructors

public Tab()

Methods

public abstract int getPosition()

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

Returns:

Current position, or ActionBar.Tab.INVALID_POSITION if this tab is not currently in the action bar.

public abstract Drawable getIcon()

Return the icon associated with this tab.

Returns:

The tab's icon

public abstract java.lang.CharSequence getText()

Return the text of this tab.

Returns:

The tab's text

public abstract ActionBar.Tab setIcon(Drawable icon)

Set the icon displayed on this tab.

Parameters:

icon: The drawable to use as an icon

Returns:

The current instance for call chaining

public abstract ActionBar.Tab setText(java.lang.CharSequence text)

Set the text displayed on this tab. Text may be truncated if there is not room to display the entire string.

Parameters:

text: The text to display

Returns:

The current instance for call chaining

public abstract ActionBar.Tab setText(int resId)

Set the text displayed on this tab. Text may be truncated if there is not room to display the entire string.

Parameters:

resId: A resource ID referring to the text that should be displayed

Returns:

The current instance for call chaining

public abstract ActionBar.Tab setCustomView(View view)

Set a custom view to be used for this tab. This overrides values set by ActionBar.Tab.setText(CharSequence) and ActionBar.Tab.setIcon(Drawable).

Parameters:

view: Custom view to be used as a tab.

Returns:

The current instance for call chaining

public abstract View getCustomView()

Retrieve a previously set custom view for this tab.

Returns:

The custom view set by ActionBar.Tab.setCustomView(View).

public abstract ActionBar.Tab setTag(java.lang.Object obj)

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

Parameters:

obj: Object to store

Returns:

The current instance for call chaining

public abstract java.lang.Object getTag()

Returns:

This Tab's tag object.

public abstract ActionBar.Tab setTabListener(ActionBar.TabListener listener)

Set the ActionBar.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: Listener to handle tab selection events

Returns:

The current instance for call chaining

public abstract void select()

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

public abstract ActionBar.Tab setContentDescription(int resId)

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: A resource ID referring to the description text

Returns:

The current instance for call chaining

See also: ActionBar.Tab.setContentDescription(CharSequence), ActionBar.Tab.getContentDescription()

public abstract ActionBar.Tab setContentDescription(java.lang.CharSequence contentDesc)

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: Description of this tab's content

Returns:

The current instance for call chaining

See also: ActionBar.Tab.setContentDescription(int), ActionBar.Tab.getContentDescription()

public abstract java.lang.CharSequence getContentDescription()

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

Returns:

Description of this tab's content

See also: ActionBar.Tab.setContentDescription(CharSequence), ActionBar.Tab.setContentDescription(int)