# ActionBar.Tab

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:appcompat-v7:28.0.0-alpha1  
Deprecated since version 24.1.0  
Summary:[Constants](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#constants)\|[Ctors](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#)  

# ActionBar.Tab

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public
static

abstract
class
ActionBar.Tab
`  
`

extends Object


``


`

|---|--------------------------------------|
| java.lang.Object                        ||
| ↳ | android.support.v7.app.ActionBar.Tab |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 24.1.0.**   
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[Fragment](https://developer.android.com/reference/android/support/v4/app/Fragment)s.

## Summary

|                                                                      ### Constants                                                                      ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [INVALID_POSITION](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#INVALID_POSITION) An invalid position for a tab. |

|                                                 ### Public constructors                                                  ||
|-----------------------------------------------------------------------------------------------------------------------|---|
| ` `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#ActionBar.Tab())`() ` |

|                                                                                                                                                                                                                                                                             ### Public methods                                                                                                                                                                                                                                                                              ||
|-----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract CharSequence`                                                                                  | ` `[getContentDescription](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getContentDescription())`() ` Gets a brief description of this tab's content for use in accessibility support.                                                                                                                                                                                                                                           |
| ` abstract `[View](https://developer.android.com/reference/android/view/View.html)                        | ` `[getCustomView](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getCustomView())`() ` Retrieve a previously set custom view for this tab.                                                                                                                                                                                                                                                                                        |
| ` abstract `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)   | ` `[getIcon](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getIcon())`() ` Return the icon associated with this tab.                                                                                                                                                                                                                                                                                                              |
| ` abstract int`                                                                                           | ` `[getPosition](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getPosition())`() ` Return the current position of this tab in the action bar.                                                                                                                                                                                                                                                                                     |
| ` abstract Object`                                                                                        | ` `[getTag](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getTag())`() `                                                                                                                                                                                                                                                                                                                                                          |
| ` abstract CharSequence`                                                                                  | ` `[getText](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getText())`() ` Return the text of this tab.                                                                                                                                                                                                                                                                                                                           |
| ` abstract void`                                                                                          | ` `[select](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#select())`() ` Select this tab.                                                                                                                                                                                                                                                                                                                                         |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setContentDescription](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setContentDescription(int))`(int resId) ` Set a description of this tab's content for use in accessibility support.                                                                                                                                                                                                                                      |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setContentDescription](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setContentDescription(java.lang.CharSequence))`(CharSequence contentDesc) ` Set a description of this tab's content for use in accessibility support.                                                                                                                                                                                                    |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setCustomView](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setCustomView(int))`(int layoutResId) ` Set a custom view to be used for this tab.                                                                                                                                                                                                                                                                               |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setCustomView](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setCustomView(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View.html)` view) ` Set a custom view to be used for this tab.                                                                                                                                                                                                   |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setIcon](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setIcon(android.graphics.drawable.Drawable))`(`[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)` icon) ` Set the icon displayed on this tab.                                                                                                                                                                                |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setIcon](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setIcon(int))`(int resId) ` Set the icon displayed on this tab.                                                                                                                                                                                                                                                                                                        |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setTabListener](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setTabListener(android.support.v7.app.ActionBar.TabListener))`(`[ActionBar.TabListener](https://developer.android.com/reference/android/support/v7/app/ActionBar.TabListener)` listener) ` Set the[ActionBar.TabListener](https://developer.android.com/reference/android/support/v7/app/ActionBar.TabListener)that will handle switching to and from this tab. |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setTag](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setTag(java.lang.Object))`(Object obj) ` Give this Tab an arbitrary object to hold for later use.                                                                                                                                                                                                                                                                       |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setText](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setText(int))`(int resId) ` Set the text displayed on this tab.                                                                                                                                                                                                                                                                                                        |
| ` abstract `[ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | ` `[setText](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setText(java.lang.CharSequence))`(CharSequence text) ` Set the text displayed on this tab.                                                                                                                                                                                                                                                                             |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` 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() `                    | ||

## Constants

### INVALID_POSITION

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int INVALID_POSITION
```

An invalid position for a tab.

<br />

**See also:**

- [getPosition()](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getPosition())

Constant Value: -1 (0xffffffff)

## Public constructors

### ActionBar.Tab

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab ()
```

<br />

<br />

## Public methods

### getContentDescription

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getContentDescription ()
```

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

<br />

|                         Returns                          ||
|----------------|------------------------------------------|
| `CharSequence` | Description of this tab's content <br /> |

**See also:**

- [setContentDescription(CharSequence)](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setContentDescription(java.lang.CharSequence))
- [setContentDescription(int)](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setContentDescription(int))  

### getCustomView

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
View getCustomView ()
```

Retrieve a previously set custom view for this tab.

<br />

|                                                                                                                  Returns                                                                                                                   ||
|------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [View](https://developer.android.com/reference/android/view/View.html) | The custom view set by[setCustomView(View)](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setCustomView(android.view.View)). <br /> |

### getIcon

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Drawable getIcon ()
```

Return the icon associated with this tab.

<br />

|                                                      Returns                                                       ||
|---------------------------------------------------------------------------------------------|-----------------------|
| [Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The tab's icon <br /> |

### getPosition

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getPosition ()
```

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

<br />

|                                                                                              Returns                                                                                               ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Current position, or[INVALID_POSITION](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#INVALID_POSITION)if this tab is not currently in the action bar. <br /> |

### getTag

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Object getTag ()
```

<br />

<br />

|                 Returns                 ||
|----------|-------------------------------|
| `Object` | This Tab's tag object. <br /> |

### getText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getText ()
```

Return the text of this tab.

<br />

|                Returns                ||
|----------------|-----------------------|
| `CharSequence` | The tab's text <br /> |

### select

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void select ()
```

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

<br />

### setContentDescription

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
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.

<br />

|                               Parameters                               ||
|---------|---------------------------------------------------------------|
| `resId` | `int`: A resource ID referring to the description text <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

**See also:**

- [setContentDescription(CharSequence)](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setContentDescription(java.lang.CharSequence))
- [getContentDescription()](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getContentDescription())  

### setContentDescription

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab setContentDescription (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.

<br />

|                               Parameters                                ||
|---------------|----------------------------------------------------------|
| `contentDesc` | `CharSequence`: Description of this tab's content <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

**See also:**

- [setContentDescription(int)](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#setContentDescription(int))
- [getContentDescription()](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab#getContentDescription())  

### setCustomView

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab setCustomView (int layoutResId)
```

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

<br />

|                                       Parameters                                       ||
|---------------|-------------------------------------------------------------------------|
| `layoutResId` | `int`: A layout resource to inflate and use as a custom tab view <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

### setCustomView

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab setCustomView (View view)
```

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

<br />

|                       Parameters                        ||
|--------|-------------------------------------------------|
| `view` | `View`: Custom view to be used as a tab. <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

### setIcon

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab setIcon (Drawable icon)
```

Set the icon displayed on this tab.

<br />

|                        Parameters                         ||
|--------|---------------------------------------------------|
| `icon` | `Drawable`: The drawable to use as an icon <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

### setIcon

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab setIcon (int resId)
```

Set the icon displayed on this tab.

<br />

|                                   Parameters                                   ||
|---------|-----------------------------------------------------------------------|
| `resId` | `int`: Resource ID referring to the drawable to use as an icon <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

### setTabListener

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab setTabListener (ActionBar.TabListener listener)
```

Set the[ActionBar.TabListener](https://developer.android.com/reference/android/support/v7/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.

<br />

|                                     Parameters                                      ||
|------------|-------------------------------------------------------------------------|
| `listener` | `ActionBar.TabListener`: Listener to handle tab selection events <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

### setTag

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab setTag (Object obj)
```

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

<br />

|               Parameters                ||
|-------|----------------------------------|
| `obj` | `Object`: Object to store <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

### setText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
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.

<br />

|                                     Parameters                                      ||
|---------|----------------------------------------------------------------------------|
| `resId` | `int`: A resource ID referring to the text that should be displayed <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

### setText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ActionBar.Tab setText (CharSequence text)
```

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

<br />

|                     Parameters                     ||
|--------|--------------------------------------------|
| `text` | `CharSequence`: The text to display <br /> |

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab) | The current instance for call chaining <br /> |

-

  ## Interfaces

  - [ActionBar.OnMenuVisibilityListener](https://developer.android.com/reference/android/support/v7/app/ActionBar.OnMenuVisibilityListener)
  - [ActionBar.OnNavigationListener](https://developer.android.com/reference/android/support/v7/app/ActionBar.OnNavigationListener)
  - [ActionBar.TabListener](https://developer.android.com/reference/android/support/v7/app/ActionBar.TabListener)
  - [ActionBarDrawerToggle.Delegate](https://developer.android.com/reference/android/support/v7/app/ActionBarDrawerToggle.Delegate)
  - [ActionBarDrawerToggle.DelegateProvider](https://developer.android.com/reference/android/support/v7/app/ActionBarDrawerToggle.DelegateProvider)
  - [AppCompatCallback](https://developer.android.com/reference/android/support/v7/app/AppCompatCallback)
-

  ## Classes

  - [ActionBar](https://developer.android.com/reference/android/support/v7/app/ActionBar)
  - [ActionBar.LayoutParams](https://developer.android.com/reference/android/support/v7/app/ActionBar.LayoutParams)
  - [ActionBar.Tab](https://developer.android.com/reference/android/support/v7/app/ActionBar.Tab)
  - [ActionBarDrawerToggle](https://developer.android.com/reference/android/support/v7/app/ActionBarDrawerToggle)
  - [AlertDialog](https://developer.android.com/reference/android/support/v7/app/AlertDialog)
  - [AlertDialog.Builder](https://developer.android.com/reference/android/support/v7/app/AlertDialog.Builder)
  - [AppCompatActivity](https://developer.android.com/reference/android/support/v7/app/AppCompatActivity)
  - [AppCompatDelegate](https://developer.android.com/reference/android/support/v7/app/AppCompatDelegate)
  - [AppCompatDialog](https://developer.android.com/reference/android/support/v7/app/AppCompatDialog)
  - [AppCompatDialogFragment](https://developer.android.com/reference/android/support/v7/app/AppCompatDialogFragment)
  - [AppCompatViewInflater](https://developer.android.com/reference/android/support/v7/app/AppCompatViewInflater)
  - [MediaRouteActionProvider](https://developer.android.com/reference/android/support/v7/app/MediaRouteActionProvider)
  - [MediaRouteButton](https://developer.android.com/reference/android/support/v7/app/MediaRouteButton)
  - [MediaRouteChooserDialog](https://developer.android.com/reference/android/support/v7/app/MediaRouteChooserDialog)
  - [MediaRouteChooserDialogFragment](https://developer.android.com/reference/android/support/v7/app/MediaRouteChooserDialogFragment)
  - [MediaRouteControllerDialog](https://developer.android.com/reference/android/support/v7/app/MediaRouteControllerDialog)
  - [MediaRouteControllerDialogFragment](https://developer.android.com/reference/android/support/v7/app/MediaRouteControllerDialogFragment)
  - [MediaRouteDialogFactory](https://developer.android.com/reference/android/support/v7/app/MediaRouteDialogFactory)
  - [MediaRouteDiscoveryFragment](https://developer.android.com/reference/android/support/v7/app/MediaRouteDiscoveryFragment)