位置: 编程技术 - 正文

include及merge在androidmanifest.xml中的作用(include eigen)

编辑:rootadmin
Re-using Layouts with <include/>PreviousNextGet started This lesson teaches you toCreate a Re-usable LayoutUse the <include> TagUse the <merge> TagYou should also readLayout Resources

推荐整理分享include及merge在androidmanifest.xml中的作用(include eigen),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:include sphere,include merge和viewstub,include and,include merge,include eigen,include eigen,include merge和viewstub,include merge和viewstub,内容如对您有帮助,希望把文章链接给更多的朋友!

Although Android offers a variety of widgets to provide small and re-usable interactive elements, you might also need to re-use larger components that require a special layout. To efficiently re-use complete layouts, you can use the<include/> and <merge/> tags to embed another layout inside the current layout.

Reusing layouts is particularly powerful as it allows you create reusable complex layouts. For example, a yes/no button panel, or custom progress bar with description text. It also means that any elements of your application that are common across multiple layouts can be extracted, managed separately, then included in each layout. So while you can create individual UI components by writing a customView, you can do it even more easily by re-using a layout file.

Create a Re-usable Layout

If you already know the layout that you want to re-use, create a new XML file and define the layout. For example, here's a layout from the G-Kenya codelab that defines a title bar to be included in each activity (titlebar.xml):

The root View should be exactly how you'd like it to appear in each layout to which you add this layout.

Use the <include> Tag

Inside the layout to which you want to add the re-usable component, add the <include/> tag. For example, here's a layout from the G-Kenya codelab that includes the title bar from above:

include及merge在androidmanifest.xml中的作用(include eigen)

Here's the layout file:

You can also override all the layout parameters (any android:layout_* attributes) of the included layout's root view by specifying them in the<include/> tag. For example:

However, if you want to override layout attributes using the <include> tag, you must override bothandroid:layout_height and android:layout_width in order for other layout attributes to take effect.

Use the <merge> Tag

The <merge /> tag helps eliminate redundant view groups in your view hierarchy when including one layout within another. For example, if your main layout is a verticalLinearLayout in which two consecutive views can be re-used in multiple layouts, then the re-usable layout in which you place the two views requires its own root view. However, using another LinearLayout as the root for the re-usable layout would result in a verticalLinearLayout inside a verticalLinearLayout. The nestedLinearLayout serves no real purpose other than to slow down your UI performance.

To avoid including such a redundant view group, you can instead use the <merge> element as the root view for the re-usable layout. For example:

Now, when you include this layout in another layout (using the <include/> tag), the system ignores the<merge> element and places the two buttons directly in the layout, in place of the<include/> tag.

ViewPager内使用FragmentPagerAdapter时滑动出现illegalstateexception解决办法 ViewPager内使用FragmentPagerAdapter时滑动出现java.lang.IllegalStateException:Thespecifiedchildalreadyhasaparent.YoumustcallremoveView()onthechild'sparentfirst,解决办法:viewpager.setOff

Android按返回键(后退键)Back键事件捕获的两种方法 packagezhangphil.back;importandroid.support.v7.app.ActionBarActivity;importandroid.util.Log;importandroid.view.KeyEvent;importandroid.os.Bundle;publicclassMainActivityextendsActionBarActivity{//打印

Android 自定义日期控件 (仿QQ,IOS7) 还记得上篇:Android日期时间选择器,本篇是根据上篇修改而来,先看下qq中日期选择的效果:鉴于目前还没有相的开源日期控件,因此本人花费了一些

标签: include eigen

本文链接地址:https://www.jiuchutong.com/biancheng/374570.html 转载请保留说明!

上一篇:Retrofit 实现上传下载文件(retrofit提交表单)

下一篇:ViewPager内使用FragmentPagerAdapter时滑动出现illegalstateexception解决办法(viewpager2+fragment)

  • 股权转让交印花
  • 汇算清缴时发现去年的成本少确认了报表怎么填列
  • 向投资者支付的股息不得在计算应纳税所得额时扣除
  • 金税盘离线开票金额超限怎么处理
  • 城市维护建设税属于什么科目
  • 转让固定资产发生的费用计入什么科目
  • 个体工商户税收起征点是多少?
  • 实收资本印花税怎么申报税目
  • 进项税额转出转多了
  • 支付明年报刊费
  • 取得进项票当月未认证
  • 弥补以前年度亏损从哪里取数
  • 赔偿款和罚款是一样的吗
  • 建筑工程预收款开票会计分录
  • 怎么更正以前年度企业所得税
  • 增值税红字发票是什么意思
  • 货款打多了退款怎么做账
  • 企业怎么通过债务转让
  • 如何正确安装和使用电脑
  • 在windows 10中
  • 关联业务往来年度报告表
  • 保证合同的担保范围包括
  • 汇率调整怎么做分录
  • iphone如何录音转文字
  • lsass.exe是什么进程
  • gdb调试工具的使用
  • 物业收取停车费归谁所有
  • 酒店的原材料和包装
  • php的api接口
  • 合营企业合营方
  • 老生常谈的常是什么意思
  • 总公司与分公司怎么报税
  • 劳动仲裁要出钱吗
  • 合伙企业与公司一样具有高度的人合性
  • 电子承兑接收了,但是后来怎么没有了
  • 贸易净利润
  • 土地补偿款会议纪要
  • 未按期兑现的合同缴纳印花税吗?
  • 外币汇兑损益怎么计算
  • 小规模纳税人税率2023年是多少
  • 个体工商户具体工作内容怎么写
  • 要多少费用?
  • 女装淘宝店铺如何盈利
  • 金税四期对企业影响
  • 计提递延所得税资产影响当期利润吗
  • 代扣款分录
  • 转出未交增值税会计处理
  • 收到保险理赔款计入什么科目
  • 期末留抵税额可以冲减欠税吗
  • 酒店会计科目表
  • 建筑企业材料费能否加计扣除
  • sql基本教程
  • mysql启动错误1067 进程意外终止
  • mysql 注入漏洞
  • ubuntu20.04忘记用户密码怎么办
  • linux服务器安装虚拟机
  • ubuntu16.04输入法
  • 32位/64位Win10系统开机后桌面图标自动排列的解决办法
  • linux 常用系统
  • nod32kui.exe - nod32kui是什么进程 作用是什么
  • win7系统如何关闭开机自动启动软件
  • Win10更新后浏览器不能联网怎么办
  • 90后的毕业照
  • 常见的css样式
  • python使用mysql数据库示例代码
  • 如何删除命令
  • linux pymol
  • Python安装教程windous7
  • 使用二氧化碳灭火器时人应该站在什么位置
  • Ubuntu、Linux Mint一键安装Chrome浏览器的Shell脚本分享
  • Android mediaplayer 白屏
  • 字典树原理
  • 深入浅出html pdf中文版
  • 目前光伏太阳能组件产量最高的国家是( )
  • 博兴公安局领导班子
  • 单位税额怎么算出来的
  • 北京税务分所怎么样啊
  • 城市维护建设税怎么算
  • 2020年个税截止时间
  • 税率分几种 分别是什么
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设