Fragment更容易实现页面的切换

来源:互联网 发布:windows http 编辑:程序博客网 时间:2024/04/29 10:19

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,以后如果想法变了也很容易改。

0 0