android tab tag,Android TabHost详解

triangle-closed.pngKnown Direct Subclasses

Class Overview

Container for a tabbed window view. This object holds two children: a set of tab labels that the user clicks to select a specific tab, and a FrameLayout object that displays the contents of that page. The individual elements are typically controlled using this container object, rather than setting values on the child elements themselves.

SummaryNested Classes

interfaceInterface definition for a callback to be invoked when tab changed

interfaceMakes the content of a tab when it is selected.

classA tab has a tab indicator, content, and a tag that is used to keep track of it.[Expand]

Inherited FieldsPublic ConstructorsPublic Methods

void

voidRemoves all tabs from the tab widget associated with this tab host.

booleanDispatch a key event to the next view on the focus path.

voidCalled when the window containing this view gains or loses window focus.

Get the FrameLayout which holds tab content

voidInitializes an

voidCallback method to be invoked when the touch mode changes.

voidSends an accessibility event of the given type.

void

voidRegister a callback to be invoked when the selected state of any of the items in this list changes

voidCall setup() before adding tabs if loading TabHost using findViewById().

voidIf you are usingProtected Methods

voidThis is called when the view is attached to a window.

voidThis is called when the view is detached from a window.

Public Constructors

publicTabHost(Context context)

publicTabHost

Public Methods

public voidaddTab

Add a tab.

ParameterstabSpecSpecifies how to create the indicator and content.

public voidclearAllTabs()

Removes all tabs from the tab widget associated with this tab host.

public booleandispatchKeyEvent

Dispatch a key event to the next view on the focus path. This path runs from the top of the view tree down to the currently focused view. If this view has focus, it will dispatch to itself. Otherwise it will dispatch the next node down the focus path. This method also fires any key listeners.

ParameterseventThe key event to be dispatched.

ReturnsTrue if the event was handled, false otherwise.

public voiddispatchWindowFocusChanged(boolean hasFocus)

Called when the window containing this view gains or loses window focus. ViewGroups should override to route to their children.

ParametershasFocusTrue if the window containing this view now has focus, false otherwise.

public intgetCurrentTab()

public StringgetCurrentTabTag()

public ViewgetCurrentTabView()

public ViewgetCurrentView()

getTabContentView()

Get the FrameLayout which holds tab content

getTabWidget()

newTabSpec

Get a new

Parameterstagrequired tag of tab.

public voidonInitializeAccessibilityEvent

Initializes an

Example: Setting the password property of an event in addition to properties set by the super implementation:publicvoidonInitializeAccessibilityEvent(AccessibilityEventevent){super.onInitializeAccessibilityEvent(event);event.setPassword(true);}

Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.

ParameterseventThe event to initialize.

public voidonTouchModeChanged(boolean isInTouchMode)

Callback method to be invoked when the touch mode changes.

ParametersisInTouchModeTrue if the view hierarchy is now in touch mode, false otherwise.

public voidsendAccessibilityEvent(int eventType)

Sends an accessibility event of the given type. If accessibility is not enabled this method has no effect. The default implementation calls

ParameterseventTypeThe type of the event to send, as defined by several types from

public voidsetCurrentTab(int index)

public voidsetCurrentTabByTag

public voidsetOnTabChangedListener

Register a callback to be invoked when the selected state of any of the items in this list changes

ParameterslThe callback that will run

public voidsetup()

Call setup() before adding tabs if loading TabHost using findViewById(). However: You do not need to call setup() after getTabHost() inmTabHost=(TabHost)findViewById(R.id.tabhost);mTabHost.setup();mTabHost.addTab(TAB_TAG_1,"Hello, world!","Tab 1");

public voidsetup

If you are using

ParametersactivityGroupUsed to launch activities for tab content.

Protected Methods

protected voidonAttachedToWindow()

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before

protected voidonDetachedFromWindow()

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值