Udostępnij za pośrednictwem


TabWidget.SetCurrentTab(Int32) Method

Definition

Sets the current tab.

[Android.Runtime.Register("setCurrentTab", "(I)V", "GetSetCurrentTab_IHandler")]
public virtual void SetCurrentTab (int index);
[<Android.Runtime.Register("setCurrentTab", "(I)V", "GetSetCurrentTab_IHandler")>]
abstract member SetCurrentTab : int -> unit
override this.SetCurrentTab : int -> unit

Parameters

index
Int32

the index of the tab that you want to indicate as the selected tab (tab brought to the front of the widget)

Attributes

Remarks

Sets the current tab.

This method is used to bring a tab to the front of the Widget, and is used to post to the rest of the UI that a different tab has been brought to the foreground.

Note, this is separate from the traditional "focus" that is employed from the view logic.

For instance, if we have a list in a tabbed view, a user may be navigating up and down the list, moving the UI focus (orange highlighting) through the list items. The cursor movement does not effect the "selected" tab though, because what is being scrolled through is all on the same tab. The selected tab only changes when we navigate between tabs (moving from the list view to the next tabbed view, in this example).

To move both the focus AND the selected tab at once, please use #focusCurrentTab. Normally, the view logic takes care of adjusting the focus, so unless you're circumventing the UI, you'll probably just focus your interest here.

Java documentation for android.widget.TabWidget.setCurrentTab(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also