# ActionBar.Tab

Artifact: [androidx.appcompat:appcompat](https://developer.android.com/jetpack/androidx/releases/appcompat) [View Source](https://cs.android.com/search?q=file:androidx/appcompat/app/ActionBar.java+class:androidx.appcompat.app.ActionBar.Tab) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

*** ** * ** ***


```
public abstract class ActionBar.Tab
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other [common navigation patterns](http://developer.android.com/design/patterns/navigation.html) instead.

A tab in the action bar.

Tabs manage the hiding and showing of `https://developer.android.com/reference/androidx/fragment/app/Fragment`s.

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#INVALID_POSITION() = -1` **This field is deprecated.** Deprecated in Java |

| ### Public constructors |
|---|
| `[Tab](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#Tab())()` **This method is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/java/lang/CharSequence.html` | `[getContentDescription](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getContentDescription())()` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/android/view/View.html` | `[getCustomView](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getCustomView())()` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `[getIcon](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getIcon())()` **This method is deprecated.** Deprecated in Java |
| `abstract int` | `[getPosition](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getPosition())()` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/java/lang/Object.html` | `[getTag](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getTag())()` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/java/lang/CharSequence.html` | `[getText](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getText())()` **This method is deprecated.** Deprecated in Java |
| `abstract void` | `[select](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#select())()` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setContentDescription](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setContentDescription(java.lang.CharSequence))(https://developer.android.com/reference/java/lang/CharSequence.html contentDesc)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setContentDescription](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setContentDescription(int))(@https://developer.android.com/reference/androidx/annotation/StringRes int resId)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setCustomView](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setCustomView(int))(int layoutResId)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setCustomView](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setCustomView(android.view.View))(https://developer.android.com/reference/android/view/View.html view)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setIcon](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setIcon(android.graphics.drawable.Drawable))(https://developer.android.com/reference/android/graphics/drawable/Drawable.html icon)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setIcon](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setIcon(int))(@https://developer.android.com/reference/androidx/annotation/DrawableRes int resId)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setTabListener](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setTabListener(androidx.appcompat.app.ActionBar.TabListener))(https://developer.android.com/reference/androidx/appcompat/app/ActionBar.TabListener listener)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setTag](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setTag(java.lang.Object))(https://developer.android.com/reference/java/lang/Object.html obj)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setText](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setText(int))(int resId)` **This method is deprecated.** Deprecated in Java |
| `abstract https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | `[setText](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setText(java.lang.CharSequence))(https://developer.android.com/reference/java/lang/CharSequence.html text)` **This method is deprecated.** Deprecated in Java |

## Constants

### INVALID_POSITION

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public static final int INVALID_POSITION = -1
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

An invalid position for a tab.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getPosition()` |   |

## Public constructors

### Tab

Added in 1.1.0 Deprecated in 1.1.0

```
public [Tab](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#Tab())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

## Public methods

### getContentDescription

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract CharSequence [getContentDescription](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getContentDescription())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html` | Description of this tab's content |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setContentDescription(java.lang.CharSequence)` |   |
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setContentDescription(int)` |   |

### getCustomView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract View [getCustomView](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getCustomView())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Retrieve a previously set custom view for this tab.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/view/View.html` | The custom view set by `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setCustomView(android.view.View)`. |

### getIcon

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract Drawable [getIcon](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getIcon())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Return the icon associated with this tab.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | The tab's icon |

### getPosition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract int [getPosition](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getPosition())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

| Returns |
|---|---|
| `int` | Current position, or `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#INVALID_POSITION()` if this tab is not currently in the action bar. |

### getTag

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract Object [getTag](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getTag())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html` | This Tab's tag object. |

### getText

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract CharSequence [getText](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getText())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Return the text of this tab.

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html` | The tab's text |

### select

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract void [select](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#select())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

### setContentDescription

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setContentDescription](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setContentDescription(java.lang.CharSequence))(CharSequence contentDesc)
```

> [!CAUTION]
> **This method is 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 |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html contentDesc` | Description of this tab's content |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setContentDescription(int)` |   |
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getContentDescription()` |   |

### setContentDescription

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setContentDescription](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setContentDescription(int))(@StringRes int resId)
```

> [!CAUTION]
> **This method is 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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/StringRes int resId` | A resource ID referring to the description text |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setContentDescription(java.lang.CharSequence)` |   |
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#getContentDescription()` |   |

### setCustomView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setCustomView](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setCustomView(int))(int layoutResId)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Set a custom view to be used for this tab. This overrides values set by `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setText(java.lang.CharSequence)` and `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setIcon(android.graphics.drawable.Drawable)`.

| Parameters |
|---|---|
| `int layoutResId` | A layout resource to inflate and use as a custom tab view |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

### setCustomView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setCustomView](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setCustomView(android.view.View))(View view)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Set a custom view to be used for this tab. This overrides values set by `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setText(java.lang.CharSequence)` and `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setIcon(android.graphics.drawable.Drawable)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/view/View.html view` | Custom view to be used as a tab. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

### setIcon

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setIcon](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setIcon(android.graphics.drawable.Drawable))(Drawable icon)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Set the icon displayed on this tab.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html icon` | The drawable to use as an icon |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

### setIcon

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setIcon](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setIcon(int))(@DrawableRes int resId)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Set the icon displayed on this tab.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int resId` | Resource ID referring to the drawable to use as an icon |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

### setTabListener

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setTabListener](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setTabListener(androidx.appcompat.app.ActionBar.TabListener))(ActionBar.TabListener listener)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Set the `https://developer.android.com/reference/androidx/appcompat/app/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 |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.TabListener listener` | Listener to handle tab selection events |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

### setTag

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setTag](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setTag(java.lang.Object))(Object obj)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html obj` | Object to store |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

### setText

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setText](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setText(int))(int resId)
```

> [!CAUTION]
> **This method is 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 |
|---|---|
| `int resId` | A resource ID referring to the text that should be displayed |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |

### setText

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
public abstract ActionBar.Tab [setText](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab#setText(java.lang.CharSequence))(CharSequence text)
```

> [!CAUTION]
> **This method is 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 |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html text` | The text to display |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.Tab` | The current instance for call chaining |