to top
Android APIs
public class

TabHost.TabSpec

extends Object
java.lang.Object
   ↳ android.widget.TabHost.TabSpec

Class Overview

A tab has a tab indicator, content, and a tag that is used to keep track of it. This builder helps choose among these options. For the tab indicator, your choices are: 1) set a label 2) set a label and an icon For the tab content, your choices are: 1) the id of a View 2) a TabHost.TabContentFactory that creates the View content. 3) an Intent that launches an Activity.

Summary

Public Methods

? Examples
String getTag()

? Examples
TabHost.TabSpec setContent(int viewId)
Specify the id of the view that should be used as the content of the tab.

? Examples
TabHost.TabSpec setContent( Intent intent)
Specify an intent to use to launch an activity as the tab content.

? Examples
TabHost.TabSpec setContent( TabHost.TabContentFactory contentFactory)
Specify a TabHost.TabContentFactory to use to create the content of the tab.

? Examples
TabHost.TabSpec setIndicator( CharSequence label)
Specify a label as the tab indicator.

? Examples
TabHost.TabSpec setIndicator( View view)
Specify a view as the tab indicator.

? Examples
TabHost.TabSpec setIndicator( CharSequence label, Drawable icon)
Specify a label and icon as the tab indicator.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public String getTag ()

Added in API level 4

public TabHost.TabSpec setContent (int viewId)

Added in API level 1

Specify the id of the view that should be used as the content of the tab.

public TabHost.TabSpec setContent (Intent intent)

Added in API level 1

Specify an intent to use to launch an activity as the tab content.

public TabHost.TabSpec setContent (TabHost.TabContentFactory contentFactory)

Added in API level 1

Specify a TabHost.TabContentFactory to use to create the content of the tab.

public TabHost.TabSpec setIndicator (CharSequence label)

Added in API level 1

Specify a label as the tab indicator.

public TabHost.TabSpec setIndicator (View view)

Added in API level 4

Specify a view as the tab indicator.

public TabHost.TabSpec setIndicator (CharSequence label, Drawable icon)

Added in API level 1

Specify a label and icon as the tab indicator.

No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.