Fragment更容易实现页面的切换

本文探讨了Fragments在应用开发中如何简化功能实现,通过展示邮件列表和邮件详细视图的片段,说明Fragments的复用性和设备适应性。即使应用不针对手机和平板开发,使用Fragments也能在未来方便地进行调整。此外,Fragments不仅用于UI组成,还能提供其他有益特性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Fragments make implementing this functionality easy. The list of emails would exist in one fragment, and the detail view for an email would exist in another fragment. Depending on the device size, our activity will decide to show either one or both of these fragments.

Fragment可以重用,可选择显示或者不显示出来
来自这里
如图:
这里写图片描述

So, this is great, but what if you aren’t developing an app that works on phones and tablets? Should you still use fragments?

The answer is yes. Using fragments now will set you up nicely if you change your mind in the future. There is no significant reason not to start with fragments from the beginning, but refactoring existing code to use fragments can be error-prone and will take time. Fragments can also provide other nice features besides UI composition.

行,这挺好的。现在就开始用Fragments,以后如果想法变了也很容易改。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值