Android的活动和观点
当开发一个Android应用程序,有没有经验的时候,你应该停止改变布局,而是切换到新的活动规则?可能会影响哪些因素决定?
When developing an Android app, is there a rule of thumb for when you should stop changing layouts and instead switch to a new activity? What factors might influence the decision?
有没有硬性规定,但我有一些个人的:
There are no hard and fast rules, but I've got a few personal ones:
我主要是想我如何将用户使用后退按钮。在一个最佳的应用程序,自然用回要经过活动是我瞄准。每次用户可能要使用背,这应该是一个新的活动。当然,规则是为了打破,有时候你需要自己重载后退按钮来控制更复杂的界面。
I primarily think of how my users will use the back button. In an optimal app, the natural use of "back" to go through Activities is what I aim for. Each time a user might want to use back, that should be a new Activity. Of course, rules are meant to broken and sometimes you'll need to override the back button yourself to control a more complex interface.
此外,你应该不会被诱惑的setContentView()
再打电话。如果你很想重做页面的整个布局,也许你应该移动到一个新的活动代替。
Also, you shouldn't be tempted to call setContentView()
again. If you are tempted to redo the entire layout of the page, maybe you should move to a new Activity instead.
我也想看看本指南。