安卓应用程序设计
我开始开发 Android 应用程序,想知道常见的应用程序设计/结构是什么样的。
在 iOS 中,我通常会从包含 UITabBarController 的 RootController 开始,并用 4-5 个 UINavigationController 填充它。每个 UINavigationController 将包含其 UIViewController 堆栈。
Android 上的类似应用程序会是什么样子?
I am starting to develop an application for Android and was wondering what the common application design/structure looks like.
In iOS, I would generally start with a RootController which contains a UITabBarController and fill this with 4-5 UINavigationControllers. Each UINavigationController would contain its stack with UIViewControllers.
What would a similar application look like for Android?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从此处开始阅读。基本构建块是 Activity,您设置 UI、显示数据并响应 Activity 类中的事件。屏幕导航是通过使用 intents 启动其他活动来处理的。
Start reading here. The basic building block is an Activity, you setup your UI, display data and respond to events in your Activity classes. Screen navigation is handled by starting other activities using intents.
我布置了我的活动和我的活动 xml 文件。然后我在活动类中所需的组件中进行编码。然后我设置首选项和子菜单等。从那里我开始我的支持课程并将其全部粘合在一起。
I lay out my activities and my activity xml files. Then I code in the components that are needed in the activity classes. Then I set up preferences and my submenu etc. From there I do my support classes and glue it all together.
Egil.. Android 方式与 iOS 方式显着不同,因为它更像是一个 Web 界面。
第一:“Activities”或 UI 可以随时被杀死。事实上,旋转手机可能会终止一项活动。这样每个Activity都需要能够在onSaveInstanceState中保存其状态并在onResume中恢复状态。此外,“共享文档类数据”在onPause()中写入并在onResume()中恢复。 iOS 中最接近的类比是在内存不足警告时保存状态。
其次:活动彼此相对独立,因此状态需要使用意图在活动(UI)之间传递,或者使用应用程序状态全局保存。
可以使用 Android 选项菜单快速将 iOS TabBar 移动到 Android,但没有像 UINavigationController 这样的内置视图层次结构。
我在此处有一个比较和对比 iOS 和 Android 的表格。
Egil.. The Android way is significantly different from the iOS way in that it is more like a web interface.
First: "Activities" or UIs can be killed at any time. In fact, rotating the phone can kill an activity. So that each Activity needs to be able to save its state in onSaveInstanceState and restore state in onResume. Furthermore, "shared document like data" is written in onPause() and restored in onResume(). The closest analogy in iOS is saving state on low memory warning.
Second: Activities are relatively independent of each other so that state needs to be passed between Activities (UIs) using intents or saved globally using say Application state.
It is possible to quickly move an iOS TabBar to Android using Androids Options menu, but there is no built in hierarchy of views like UINavigationController.
I have a table comparing and contrasting iOS and Android here.
看看 Android Design in Action,他们有关于如何设计 Android 应用程序的精彩视频课程!
Take a look at Android Design in Action, they have great video lessons on how to design Android apps!