如何删除/替换Android中的选项卡活动?
我已经实现了 4 个选项卡,每个选项卡都有一个与其关联的活动。是否建议删除/替换这些活动以获得更好的应用程序性能?如果是的话该怎么办?
I have implemented 4 tabs, each having an activity assosiated with it. Is it advisable to remove/replace those activities for better performance of app? If yes then how to do it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我真的怀疑使用 3 个选项卡而不是 4 个选项卡会显着改变性能。您需要拥有适合您的应用程序的尽可能多的选项卡。在我的应用程序中,我需要 4 个选项卡,因为如果有 3 个,那么使用能力就会很差,并且导航会很混乱。
如果您想要 5 个以上的选项卡,那么我建议取消 tabwidget,然后实现您自己的自定义布局(可能是水平滚动视图),如 WeatherBug 中实现的那样。然后,在该自定义布局上,在每个按钮或 imageView 或自定义布局中的任何内容上,您将在视图的 onClick 中调用
setCurrentTab
。我有 4 个这样的选项卡:
I really doubt that having 3 tabs instead of 4 will noticeably change performance. You need to have as many tabs as suits your app. In my app, I need 4 tabs because if I had 3, then the use ability would be bad, and it would be confusing to navigate.
If you want 5+ tabs, then I'd recommend doing away with the tabwidget and then implement your own custom layout (possibly a horiziontal scrollview) as is implemented in WeatherBug. Then on that custom layout, on each button or imageView or whatever is in your custom layout, you would call
setCurrentTab
in an onClick for the views.And I have 4 tabs like this: