Android的活动和观点 [英] Android Activities and Views

查看:112
本文介绍了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.

我也想看看本指南

这篇关于Android的活动和观点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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