android开发中的视图和活动有什么区别?

编程入门 行业动态 更新时间:2024-10-25 07:25:50
本文介绍了android开发中的视图和活动有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我什么时候需要创建一个新的活动,什么时候需要更改视图?

When do I need to create a new activity and when do I need to change the view?

我的应用程序需要执行以下操作:

My app needs to do:

两个大按钮(菜单的一种)

two big buttons(sort of menu)

项目列表-取决于上一个屏幕上的选择

list of items - depend on the selection on prev screen

另一个列表-取决于上一个屏幕上的选择

another list - depend on the selection on prev screen

显示项目

所有屏幕都必须具有相同的菜单菜单(最后一个具有另一个按钮)

All screens need to have the same menu menu (the last has another button)

我需要为每个屏幕创建一个活动还是只在同一活动中更改视图?

Do I need to create an activity for each screen or just change the view in the same activity?

也许我需要创建一个父类 myBase 来扩展活动,而我所有的活动都将扩展他?

Maybe I need to create a parent class myBase that will extend activity and all my activities will extend him?

推荐答案

您应该为屏幕创建单独的活动.Android通过从堆栈中弹出当前活动并显示最后一个活动来处理设备的后退按钮.因此,例如,如果用户要返回到屏幕2进行其他选择,则返回按钮可以执行此操作.

You should create separate activities for you screens. Android handles the back button of the device by popping the current activity out from the stack and displaying the last one. So if for example the user wants to return to screen 2 for another selection, the back button does this.

更多推荐

android开发中的视图和活动有什么区别?

本文发布于:2023-11-23 05:07:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620191.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   有什么区别   android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!