位置: 编程技术 - 正文

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)

  • 公司房产税如何
  • 怎么根据实发工资算应发工资
  • 股票交易费用计算器
  • 建筑业适用什么行业
  • 注册地址与实际办公地址不一致怎么办
  • 支付一年房租计入什么科目
  • 少数股东权益如何保障
  • 法人转钱进公账要交税吗
  • 工伤费用的伤残补助金属于福利费吗
  • 发票复印件怎么打印
  • 施工企业营改增税费有哪些
  • 异地承包工程预缴什么税?
  • 企业拆迁补偿款会计分录
  • 冲红的电子发票要怎么处理
  • 价内税和价外税区别
  • 促销费属于哪个税目
  • 甲公司聘用乙为业务经理
  • 人防设施建设费
  • 没收到发票可以勾选认证吗
  • 营改增房租增值税税率
  • 定率征收怎么申报
  • 收到捐赠的固定资产需要折旧吗
  • 往来款核销需要如何确认
  • 工会上缴40%的经费法律依据
  • mac硬盘的常见问题及解决
  • 会计档案的保管期限是从什么算起
  • word的拼写检查总是变成法语
  • dreamweaver 是什么
  • 苹果手机系统升级后电量消耗快
  • 农产品个体销售税率多少
  • 长期应收款在哪一章
  • 原生php写接口
  • 劳务费还没发可以先计提吗
  • 福利费需要缴税吗
  • 利润分配怎样做分录
  • 非独立核算的分公司怎么做账
  • PyTorch 深度学习实战 | DIEN 模拟兴趣演化的序列网络
  • nodejs官方文档
  • php的urlencode
  • 自建自用 房产税
  • 企业购买的土地出买后无法收回资金属国有资产流失吗?
  • hashmap教程
  • 其他权益工具投资
  • 全套工商登记资料都有什么
  • mysql查询性能优化
  • 制造行业结转成本
  • 资产负债表中利息收入填在哪
  • Access数据库文件以什么作为文件后缀名
  • mysql密码忘了咋办
  • 什么情况下要缴纳房产税
  • 停车费报销会计分录
  • 账务处理的种类有哪些
  • 一般纳税人其他咨询服务税率
  • 研发折旧怎么分类
  • 生产成本如何做核算
  • 滞纳金一般什么时候交
  • 固定资产折旧如何计提
  • 销项负数发票开了需要给对方重开发票吗?
  • 汇算清缴退费怎么入账
  • 购买咨询服务费计入什么科目
  • 银行结算账户的基本要求
  • sql删除查询结果
  • mysql注入语句
  • sqlserver允许一列列值重复
  • xp系统无法停用wifi连接
  • 如何更改ubuntu下载源
  • Win10 Build 10586.494稳定版更新修复内容以及KB3172985补丁下载地址
  • windows10 rs4
  • cocos2dx场景切换
  • opengl oes纹理
  • node.js gui
  • nodejs中的shell命令是什么意思
  • 输出语句的执行过程
  • html头像代码
  • shell脚本wc
  • vue实现数据导出为excel
  • jquery倒计时代码
  • nodejs拼接路径的方法
  • python切片菜鸟教程
  • 专家费缴税标准
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设