完整内容请查看:http://www.zhdoc.net/android/reference/android/widget/TabWidget.html
TabWidget
public class TabWidget
extends LinearLayout
implements View.OnFocusChangeListener
java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.LinearLayout | |||
↳ | android.widget.TabWidget |
Displays a list of tab labels representing each page in the parent's tab collection.
显示一个选项卡标签的列表,这些标签代表了父选项卡的每个页面。
The container object for this widget is TabHost
. When the user selects a tab, this object sends a message to the parent container, TabHost, to tell it to switch the displayed page. You typically won't use many methods directly on this object. The container TabHost is used to add labels, add the callback handler, and manage callbacks. You might call this object to iterate the list of tabs, or to tweak the layout of the tab list, but most methods should be called on the containing TabHost object.
此widget的容器对象是TabHost
。当用户选择了选项卡,此对象将发送一个消息到它的父容器TabHost中,以告诉它切换显示页面。你通常不需要在这个对象上调用很多方法。TabHost容器用于添加标签,回调处理方法,并管理回调。你可以调用这个对象来迭代选项卡的列表,或者调整选项卡的列表的布局,但是大多数方法应该在包含TabHost对象上调用。
摘要
XML属性 | |
---|---|
android:divider | 用于绘制选项卡间分隔栏的Drawable。 |
android:tabStripEnabled | 确定是否绘制选项卡指示器中的下划线。 |
android:tabStripLeft | 用来绘制选项卡下面的分割线左边部分的drawable。 |
android:tabStripRight | 用来绘制选项卡下面的分割线右边部分的drawable。 |
继承XML属性 | |
---|---|
![]() android.widget.LinearLayout
| |
![]() android.view.ViewGroup
| |
![]() android.view.View
|
继承常量 |
---|
![]() android.widget.LinearLayout
|
![]() android.view.ViewGroup
|
![]() android.view.View
|
继承字段 |
---|
![]() android.view.View
|
Public构造方法 | |
---|---|
TabWidget(Context context) | |
TabWidget(Context context, AttributeSet attrs) | |
TabWidget(Context context, AttributeSet attrs, int defStyleAttr) | |
TabWidget(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) |
Public方法 | |
---|---|
void | addView(View child) Adds a child view. |
void | childDrawableStateChanged(View child) If |
void | dispatchDraw(Canvas canvas) Called by draw to draw the child views. |
void | focusCurrentTab(int index) Sets the current tab and focuses the UI on it. |
CharSequence | getAccessibilityClassName() Return the class name of this object to be used for accessibility purposes. |
View | getChildTabViewAt(int index) Returns the tab indicator view at the given index. |
Drawable | getLeftStripDrawable() |
Drawable | getRightStripDrawable() |
int | getTabCount() Returns the number of tab indicator views. |
boolean | isStripEnabled() Indicates whether the bottom strips on the tab indicators are drawn or not. |
void | onFocusChange(View v, boolean hasFocus) Called when the focus state of a view has changed. |
PointerIcon | onResolvePointerIcon(MotionEvent event, int pointerIndex) Returns the pointer icon for the motion event, or null if it doesn't specify the icon. |
void | removeAllViews() Call this method to remove all child views from the ViewGroup. |
void | setCurrentTab(int index) Sets the current tab. |
void | setDividerDrawable(int resId) Sets the drawable to use as a divider between the tab indicators. |
void | setDividerDrawable(Drawable drawable) Sets the drawable to use as a divider between the tab indicators. |
void | setEnabled(boolean enabled) Set the enabled state of this view. |
void | setLeftStripDrawable(Drawable drawable) Sets the drawable to use as the left part of the strip below the tab indicators. |
void | setLeftStripDrawable(int resId) Sets the drawable to use as the left part of the strip below the tab indicators. |
void | setRightStripDrawable(int resId) Sets the drawable to use as the right part of the strip below the tab indicators. |
void | setRightStripDrawable(Drawable drawable) Sets the drawable to use as the right part of the strip below the tab indicators. |
void | setStripEnabled(boolean stripEnabled) Controls whether the bottom strips on the tab indicators are drawn or not. |