简体   繁体   English

活动还是片段? 帮我选择

[英]activity or fragment? help me out to choose

There are 3 similar screens in my app.我的应用程序中有 3 个类似的屏幕。 So doubt is what should I create for these screens Activity or Fragment.所以疑问是我应该为这些屏幕创建什么 Activity 或 Fragment。 登录屏幕弹出 注册屏幕弹出窗口 忘记密码弹出窗口

As per the given UI, Fragments would be the best option.根据给定的 UI,片段将是最佳选择。 I would suggest you, use the Navigation component for the fragment navigation.我建议您使用 Navigation 组件进行片段导航。

You can visit the documentation of Navigation Component by Jetpack: Navigation component Guide您可以访问 Jetpack Navigation Component 的文档: Navigation component Guide

Happy Coding :)快乐编码:)

Use fragments for this scenario, because fragments gives the freedom to reuse the components and also maintains the back navigation in such scenarios.在这种情况下使用片段,因为片段可以自由地重用组件,并在这种情况下维护后退导航。

Also do take a look at the Android's Navigation Component.也请看一下Android 的导航组件。 , as you can maintain the flow of the navigation of the application properly. ,因为您可以正确维护应用程序的导航流程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 仅在活动中选择,并与托管活动一起进行分段 - Choose among activity only and fragment with hosting activity 从活动中选择图像并显示在片段android中 - choose image from activity and display in fragment android 在Fragment活动中,我曾经用onclick事件调用listview,并在listview onclick事件中显示了不同的数据。请帮助我 - In Fragment activity i used to call listview with onclick event with showing different data in listview onclick event.please help me 将数据从 ACTIVITY 传递到 FRAGMENT 对我不起作用 - Passing Data from ACTIVITY to FRAGMENT not working with me 如何从特定活动中选择打开哪个片段? - How to choose which fragment to open from specific activity? 我正在尝试从后台运行的服务开始一项活动,但是该服务无法正常工作..有人可以帮帮我吗? - I'm trying to start an activity from a service running in background but its not working..can anyone help me out? 帮我在Android上选择XML还是SQL Lite - Help me choose between XML or SQL Lite on android 找出添加了哪些活动片段 - Find out in which activity fragment was added 按下按钮后退出片段或活动 - Backing out of a fragment or activity when a button is pressed 如何在条件下使Android中的片段活动变灰 - How to grey out fragment activity in android on condition
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM