public class TabSwitcherButton extends AppCompatImageButton implements TabSwitcherListener
TabSwitcher by using a TabSwitcherDrawable. It must be registered at a TabSwitcher instance in order to keep the displayed count up to date. It therefore implements
the interface TabSwitcherListener.| Constructor and Description |
|---|
TabSwitcherButton(android.content.Context context)
Creates a new image button, which allows to display the number of tabs, which are currently
contained by a
TabSwitcher. |
TabSwitcherButton(android.content.Context context,
android.util.AttributeSet attributeSet)
Creates a new image button, which allows to display the number of tabs, which are currently
contained by a
TabSwitcher. |
TabSwitcherButton(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
Creates a new image button, which allows to display the number of tabs, which are currently
contained by a
TabSwitcher. |
| Modifier and Type | Method and Description |
|---|---|
void |
onAllTabsRemoved(TabSwitcher tabSwitcher,
Tab[] tabs,
Animation animation)
The method, which is invoked, when all tabs have been removed from the tab switcher.
|
void |
onSelectionChanged(TabSwitcher tabSwitcher,
int selectedTabIndex,
Tab selectedTab)
The method, which is invoked, when the currently selected tab has been changed.
|
void |
onSwitcherHidden(TabSwitcher tabSwitcher)
The method, which is invoked, when the tab switcher has been hidden.
|
void |
onSwitcherShown(TabSwitcher tabSwitcher)
The method, which is invoked, when the tab switcher has been shown.
|
void |
onTabAdded(TabSwitcher tabSwitcher,
int index,
Tab tab,
Animation animation)
The method, which is invoked, when a tab has been added to the tab switcher.
|
void |
onTabRemoved(TabSwitcher tabSwitcher,
int index,
Tab tab,
Animation animation)
The method, which is invoked, when a tab has been removed from the tab switcher.
|
void |
setCount(int count)
Updates the image button to display a specific value.
|
public TabSwitcherButton(android.content.Context context)
TabSwitcher.context - The context, which should be used by the view, as an instance of the class Context. The context may not be nullpublic TabSwitcherButton(android.content.Context context,
android.util.AttributeSet attributeSet)
TabSwitcher.context - The context, which should be used by the view, as an instance of the class Context. The context may not be nullattributeSet - The attribute set, the view's attributes should be obtained from, as an instance of
the type AttributeSet or null, if no attributes should be obtainedpublic TabSwitcherButton(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
TabSwitcher.context - The context, which should be used by the view, as an instance of the class Context. The context may not be nullattributeSet - The attribute set, the view's attributes should be obtained from, as an instance of
the type AttributeSet or null, if no attributes should be obtaineddefaultStyle - The default style to apply to this view. If 0, no style will be applied (beyond what
is included in the theme). This may either be an attribute resource, whose value will
be retrieved from the current theme, or an explicit style resourcepublic final void setCount(int count)
count - The value, which should be displayed, as an Integer value. The value must be
at least 0public final void onSwitcherShown(TabSwitcher tabSwitcher)
TabSwitcherListeneronSwitcherShown in interface TabSwitcherListenertabSwitcher - The observed tab switcher as an instance of the class TabSwitcher. The tab
switcher may not be nullpublic final void onSwitcherHidden(TabSwitcher tabSwitcher)
TabSwitcherListeneronSwitcherHidden in interface TabSwitcherListenertabSwitcher - The observed tab switcher as an instance of the class TabSwitcher. The tab
switcher may not be nullpublic final void onSelectionChanged(TabSwitcher tabSwitcher, int selectedTabIndex, Tab selectedTab)
TabSwitcherListeneronSelectionChanged in interface TabSwitcherListenertabSwitcher - The observed tab switcher as an instance of the class TabSwitcher. The tab
switcher may not be nullselectedTabIndex - The index of the currently selected tab as an Integer value or -1, if the tab
switcher does not contain any tabsselectedTab - The currently selected tab as an instance of the class Tab or null, if the
tab switcher does not contain any tabspublic final void onTabAdded(TabSwitcher tabSwitcher, int index, Tab tab, Animation animation)
TabSwitcherListeneronTabAdded in interface TabSwitcherListenertabSwitcher - The observed tab switcher as an instance of the class TabSwitcher. The tab
switcher may not be nullindex - The index of the tab, which has been added, as an Integer valuetab - The tab, which has been added, as an instance of the class Tab. The tab may
not be nullanimation - The animation, which has been used to add the tab, as an instance of the class Animation. The animation may not be nullpublic final void onTabRemoved(TabSwitcher tabSwitcher, int index, Tab tab, Animation animation)
TabSwitcherListeneronTabRemoved in interface TabSwitcherListenertabSwitcher - The observed tab switcher as an instance of the class TabSwitcher. The tab
switcher may not be nullindex - The index of the tab, which has been removed, as an Integer valuetab - The tab, which has been removed, as an instance of the class Tab. The tab may
not be nullanimation - The animation, which has been used to remove the tab, as an instance of the class
Animation. The animation may not be nullpublic final void onAllTabsRemoved(TabSwitcher tabSwitcher, Tab[] tabs, Animation animation)
TabSwitcherListeneronAllTabsRemoved in interface TabSwitcherListenertabSwitcher - The observed tab switcher as an instance of the class TabSwitcher. The tab
switcher may not be nulltabs - An array, which contains the tabs, which have been removed, as an array of the type
Tab or an empty array, if no tabs have been removedanimation - The animation, which has been used to remove the tabs, as an instance of the class
Animation. The animation may not be null