英文:
Can there be a hierarchy of activities in Android?
问题
我正在构建一个移动银行应用程序。第一个活动是 LoginActivity
。如果用户输入正确的凭据,将打开一个新的活动 HomePageActivity
。这里有一个 FrameLayout
,可以在 4 个片段之间切换:HomeFragment
、TransactionsFragment
、TransfersFragment
、ReportsFragment
。在 HomeFragment
中有一个按钮,当按下时,会出现一个 DialogFragment
:AddDepositFragment
。等等。我已经包含了一张表示"层次结构"的图片。
现在的问题是:这可以被视为一个层次结构吗?
英文:
So I am building a mobile banking application. The first activity is the LoginActivity
. If the user enters the correct credentials, a new activity is opened, HomePageActivity
. Here is a FrameLayout
that can be switch between 4 fragments: HomeFragment
, TransactionsFragment
, TransfersFragment
, ReportsFragment
. In the HomeFragment
is a button that when pressed, a DialogFragment
appears : AddDepositFragment
. And so on. I have included a picture representing the "hierarchy".
And now the question is: CAN this be considered a hierarchy?
答案1
得分: 0
"Activities" 被组织在 "stack" 中。每个你已经打开的 "Activity" 都被放置在这个 "stack" 的顶部。
"Android" 支持修改这种行为,例如,新打开的 "Activity" 可以放在新的 "stack" 中。要了解更多可能的选项,请查看此官方文档。
多窗口模式需要进一步调查。
从你的问题中,我了解到你在询问什么。术语 'hierarchy' 通常在传统的 OOP
术语中使用,并且在 Java
或 Kotlin
Android
中也得到支持:你可以创建一个 BaseActivity()
,然后扩展它以用于 LoginActivity
和 HomePageActivity
。
英文:
Activities
are organised in the stack
. Each Activity
you have been opened is put on the top of this stack
.
Android
supports modification of such behaviour, e.g. newly opened Activity
is put in the new stack
. To learn more about possible options check this official docs.
A case of multi-window mode requires more investigation.
From your question I understand what you have been asking about. The term 'hierarchy' is usually used in traditional terms of OOP
and it is also supported in both Java
or Kotlin
Android
: you could create a BaseActivity()
and extend it for both LoginActivity
and HomePageActivity
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论