如何获得标签的android的位置? [英] How to get the position of tab android?
问题描述
我有对制表插件的小疑问。
I am Having the small doubt on tab-widget.
- 我怎样才能获得标签控件的位置动态?
- 假设有20个标签,当我在10片我需要显示该选项卡的位置上点击。
推荐答案
使用OnTabChangeListener接口TabHost
use OnTabChangeListener interface to TabHost
的http://developer.android.com/reference/android/widget/TabHost.OnTabChangeListener.html onTabChanged(字符串tabId)
这会给你选择的标签结果的字符串ID
并使用 setCurrentTabByTag(字符串标签)
TabHost来得到当前的标签
http://developer.android.com/reference/android/widget/TabHost.OnTabChangeListener.html
onTabChanged(String tabId)
this will give you String id of selected tab
and use setCurrentTabByTag(String tag)
of TabHost to get current Tab
或
http://developer.android.com/reference/android/widget/ TabHost.html 结果字符串getCurrentTabTag()
会给currentTab标签字符串结果 INT getCurrentTab()
会给你currentTab INT位置
http://developer.android.com/reference/android/widget/TabHost.html
String getCurrentTabTag()
will give currentTab Tag string
int getCurrentTab()
will give you currentTab int position
这篇关于如何获得标签的android的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!