使用视图,而不是一个活动的每个标签 [英] Using views instead of an activity for each tab

查看:146
本文介绍了使用视图,而不是一个活动的每个标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这实际上是扩展版的<一个href=\"http://stackoverflow.com/questions/5694406/alternatives-to-using-an-activity-for-each-tab\">Alternatives使用一个活动为每个标签。问题的关键是使用视图,而不是活动实际上是一个好主意。如果我有一个按钮或一些文字,然后它的罚款。但是,如果我需要的是一个活动上标签的变化来启动,就像一个摄像头呢?它仍然有效使用的观点,而不是活动?如果是这样,我怎么办呢?因为调用新的意图,每次也是沉重的记忆,我认为。

This is actually extended version of Alternatives to using an activity for each tab. The point is using views instead of activity is actually a good idea. If I have a button or some text then its fine. But what if I actually want an activity to be started on tab change, like a camera ? Is it still efficient to use views instead of activity ? If so, how do I do it ? Because calling new intent everytime is also heavy on memory I think.

推荐答案

如果你想用一个标签的变化推出了一个活动,然后使用活动。除非你确定你有问题,不要挂了效率。

If you want an activity launched with a tab change, then use activities. Don't get hung up on efficiency unless you're certain you have problems.

视图是presumably更有效,因为他们没有推出一个活动,但因为你是无论如何推出一个活动,你有什么收获?我使用标签式活动在我的应用程序,他们是很好,甚至在我的动力不足的手机。

Views are presumably more efficient because they don't launch an activity, but since you're launching an activity anyway, what do you gain? I use tabbed activities in my app and they're fine, even on my underpowered phone.

记住...

premature优化是一切罪恶的根

这篇关于使用视图,而不是一个活动的每个标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆