- 1、本文档共5页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
建立androidUI
Building a Flexible UI
This lesson teaches you to
HYPERLINK /training/basics/fragments/fragment-ui.html \l AddAtRuntime Add a Fragment to an Activity at Runtime
HYPERLINK /training/basics/fragments/fragment-ui.html \l Replace Replace One Fragment with Another
You should also read
HYPERLINK /guide/components/fragments.html Fragments
HYPERLINK /guide/practices/tablets-and-handsets.html Supporting Tablets and Handsets
Try it out
HYPERLINK /shareables/training/FragmentBasics.zip Download the sample
FragmentBasics.zip
When designing your application to support a wide range of screen sizes, you can reuse your fragments in different layout configurations to optimize the user experience based on the available screen space.
For example, on a handset device it might be appropriate to display just one fragment at a time for a single-pane user interface. Conversely, you may want to set fragments side-by-side on a tablet which has a wider screen size to display more information to the user.
Figure 1. Two fragments, displayed in different configurations for the same activity on different screen sizes. On a large screen, both fragment fit side by side, but on a handset device, only one fragment fits at a time so the fragments must replace each other as the user navigates.
The HYPERLINK /reference/android/support/v4/app/FragmentManager.html FragmentManager class provides methods that allow you to add, remove, and replace fragments to an activity at runtime in order to create a dynamic experience.
Add a Fragment to an Activity at Runtime
Rather than defining the fragments for an activity in the layout file—as shown in the HYPERLINK /training/basics/fragments/creating.html previous lesson with the fragment element—you can add a fragment to the activity during the activity runtime. This is necessary if you plan to change fragments during the life of the activity.
To perform a transaction such as add or remove a fragment, you must use the HYPERLINK /refer
您可能关注的文档
- 初二其中考试数学测试.doc
- 市调报告(和源中环企业广场).doc
- ModbusRTU协议文档.doc
- summer夏天英文.ppt
- 阅读教学课题研究实施方案.doc
- 2008年江西部分学校5月联考(文理合卷).doc
- 高二竞赛立体几何大题.doc
- 城市经济与城市开发.doc
- 财政与金融作业一.doc
- 小学校创先争优.doc
- 纺织服装_化妆品_医美行业2022年年度投资策略_50页_4mb.pptx
- 【工信部】2024建筑和卫生陶瓷行业节能诊断服务指南.pptx
- 【中国建筑节能协会】中国城市绿色低碳建材应用现状评估报告_59页_1mb.pptx
- 【荣续ESG智库】2024建筑行业ESG白皮书_51页_22mb.pptx
- 牛津经济研究院-二手服装对非洲和欧盟27国的社会经济影响+(英)-2024.10-156页_3mb.pptx
- 【印度服装出口促进委员会_AEPC_】2025年春夏全球时尚趋势报告_92页_21mb.pptx
- 纺织服装行业2022年度策略:竞争加剧,个股分化,产品为王-20211110-国盛证券-54页_2mb.pptx
- 20191219-天风证券-纺织服装行业投资策略:野百合也有春天,纺服也有核心资产_64页_3mb.pptx
- 【深圳市住房和建设局】深圳市住房和建设局:深圳市公共建筑能耗监测情况报告(2023年度)_65页_2mb.pptx
- 2022北京市建筑低碳高质量发展的路径和行动报告-北京市可持续发展促进会_66页_2mb.pptx
文档评论(0)