public static final class XTabLayout.Tab
extends java.lang.Object
XTabLayout.newTab().| 限定符和类型 | 字段和说明 |
|---|---|
static int |
INVALID_POSITION
An invalid position for a tab.
|
| 限定符和类型 | 方法和说明 |
|---|---|
java.lang.CharSequence |
getContentDescription()
Gets a brief description of this tab's content for use in accessibility support.
|
android.view.View |
getCustomView()
Returns the custom view used for this tab.
|
android.graphics.drawable.Drawable |
getIcon()
Return the icon associated with this tab.
|
int |
getPosition()
Return the current position of this tab in the action bar.
|
java.lang.Object |
getTag() |
java.lang.CharSequence |
getText()
Return the text of this tab.
|
int |
getTextWidth() |
boolean |
isSelected()
Returns true if this tab is currently selected.
|
void |
select()
Select this tab.
|
XTabLayout.Tab |
setContentDescription(java.lang.CharSequence contentDesc)
Set a description of this tab's content for use in accessibility support.
|
XTabLayout.Tab |
setContentDescription(int resId)
Set a description of this tab's content for use in accessibility support.
|
XTabLayout.Tab |
setCustomView(int resId)
Set a custom view to be used for this tab.
|
XTabLayout.Tab |
setCustomView(android.view.View view)
Set a custom view to be used for this tab.
|
XTabLayout.Tab |
setIcon(android.graphics.drawable.Drawable icon)
Set the icon displayed on this tab.
|
XTabLayout.Tab |
setIcon(int resId)
Set the icon displayed on this tab.
|
XTabLayout.Tab |
setTag(java.lang.Object tag)
Give this Tab an arbitrary object to hold for later use.
|
XTabLayout.Tab |
setText(java.lang.CharSequence text)
Set the text displayed on this tab.
|
XTabLayout.Tab |
setText(int resId)
Set the text displayed on this tab.
|
public static final int INVALID_POSITION
getPosition(),
常量字段值@Nullable public java.lang.Object getTag()
public int getTextWidth()
@NonNull public XTabLayout.Tab setTag(@Nullable java.lang.Object tag)
tag - Object to store@Nullable public android.view.View getCustomView()
@NonNull public XTabLayout.Tab setCustomView(@Nullable android.view.View view)
If the provided view contains a TextView with an ID of
R.id.text1 then that will be updated with the value given
to setText(CharSequence). Similarly, if this layout contains an
ImageView with ID R.id.icon then it will be updated with
the value given to setIcon(Drawable).
view - Custom view to be used as a tab.@NonNull public XTabLayout.Tab setCustomView(@LayoutRes int resId)
If the inflated layout contains a TextView with an ID of
R.id.text1 then that will be updated with the value given
to setText(CharSequence). Similarly, if this layout contains an
ImageView with ID R.id.icon then it will be updated with
the value given to setIcon(Drawable).
resId - A layout resource to inflate and use as a custom tab view@Nullable public android.graphics.drawable.Drawable getIcon()
public int getPosition()
INVALID_POSITION if this tab is not currently in
the action bar.@Nullable public java.lang.CharSequence getText()
@NonNull public XTabLayout.Tab setIcon(@Nullable android.graphics.drawable.Drawable icon)
icon - The drawable to use as an icon@NonNull public XTabLayout.Tab setIcon(@DrawableRes int resId)
resId - A resource ID referring to the icon that should be displayed@NonNull public XTabLayout.Tab setText(@Nullable java.lang.CharSequence text)
text - The text to display@NonNull public XTabLayout.Tab setText(@StringRes int resId)
resId - A resource ID referring to the text that should be displayedpublic void select()
public boolean isSelected()
@NonNull public XTabLayout.Tab setContentDescription(@StringRes int resId)
resId - A resource ID referring to the description textsetContentDescription(CharSequence),
getContentDescription()@NonNull public XTabLayout.Tab setContentDescription(@Nullable java.lang.CharSequence contentDesc)
contentDesc - Description of this tab's contentsetContentDescription(int),
getContentDescription()@Nullable public java.lang.CharSequence getContentDescription()
setContentDescription(CharSequence),
setContentDescription(int)