Flex:是否可以隐藏选项卡导航器中的某些选项卡并仅在发生特定事件时才显示它们
我正在使用选项卡导航器。它有三个选项卡“搜索”、“显示为文本”、“在地图上显示”
我在“搜索”选项卡中有一个地址搜索框。如果搜索尚未发生,我想隐藏其他两个选项卡。因此,如果用户没有搜索任何内容,其他两个选项卡就不应该可见。
你能告诉我如何实现这一目标吗?
隐藏选项卡是首选方式。 第二个选项是禁用选项卡,直到搜索完成。
I am using tab navigator. And it has thee tabs "Search", "Show as text", "Show on map"
I have a address search box in Search tab. I would like to hide other two tabs if search has not happened yet. So if user hasn't searched any thing other two tabs shouldn't be visible.
Can you please tell me how can I achieve this?
Hiding tabs is a preferred way.
Second option is to disable tabs until search is done.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有几种方法可以做到这一点。
使用 TabNavigator 的 getTabAt() 方法,该方法返回组成可视选项卡的 Button,并将visible 属性设置为 false。绑定可能会很棘手。
另一个选项是在 TabNavigaor 上添加ChildAt 或removeChildAt,具体取决于您要显示或隐藏的选项卡。
正如您提到的,禁用也可以。通过将选项卡的容器设置为禁用来执行此操作。
There are a couple ways to do this.
Use the TabNavigator's getTabAt() method which returns the Button that makes up the visual tab and set the visible property to false. It can be tricky with bindings.
The other option is to addChildAt or removeChildAt on the TabNavigaor depending on what tabs you want to show or hide.
As you mention disabling could also work. Do this by as well setting the tab's container to disabled.
我在选项卡导航器上使用了removeChildAt并且工作正常。但是,如果您想在选定的选项卡上执行特定操作,那么您应该考虑其他解决方案,因为已删除的子项在选项卡导航器中不再可用。
I had used removeChildAt on tab navigator and works fine. But if you want to do specific actions on selected Tab then you should think about other solution because the removedChild is no longer available in tab navigator.