“取消选择” TabHost 中的选项卡
我有一个 TabHost,包含 5 个选项卡。 据我所知,必须始终选择一个选项卡。
我需要一种方法来取消选择所有选项卡,这样就不会选择任何选项卡。
如果选项卡主机的意思是始终选择一个选项卡, 我怎样才能让它看起来(用户界面)就像未选择该选项卡一样?
I have a TabHost holding 5 tabs.
As far as I can see, there has to be one tab selected at all times.
I need a way to unselect all my tabs so none will be selected.
If the tabhost is meant by general to have one tab selected at all times,
how can I make it appear (UI speaking) as if the tab isn't selected?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个:
或者您可以添加隐藏选项卡,并在您想要取消选择选项卡时选择它
,并在需要时选择此选项卡
try this:
or you can add hidden tab and select it when you want unselect a tab
and select this tab when you want
据我所知这是不可能的。但是,是的,您可以将选定选项卡的颜色设置为看起来像未选定的,并通过在“未选定”时管理全局变量并在希望其正常向用户显示时设置正常布局来在其上设置空白布局。但这是一种伎俩。
希望,你明白我的意思!
编辑:
假设您在代码中的某处设置了
String What="disappear"
以显示它“未选择”,那么您可以使用此函数来更改选项卡的颜色:< strong>Main.class:
在您的活动类(由所选选项卡打开)中:
FirstActivity.class:
blank.xml:
This is not possible AFAIK. but yes,you can set the selected tab's color to look like it is unselected and set a blank layout over it by managing a global variable when you make it 'unselected' and setting up normal layout when you want it to be shown normally to user. But this is kind of a trick.
Hope,you get my point!
EDIT :
Suppose you have set
String what="disappear"
somewhere in your code to show it 'unselected',then you can use this function to change color of tab:Main.class:
And in your activity class(which is opened by that selected tab):
FirstActivity.class:
blank.xml:
为此,也许使用 tabHost 不是正确的方法?
For this purpose, maybe using tabHost is not the proper way ?