位置: 编程技术 - 正文

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)

  • 简易计税方法是什么意思
  • 小规模纳税人0税率发票
  • 购买财务软件可以抵税吗
  • 外购的商品用于生产
  • 支票上的法人章和财务章是央行盖吗
  • 预缴纳税和年度汇缴
  • 个体工商户报税一年几次
  • 开票加收税点会减少吗
  • 财务会计制度名称一般是
  • 资本公积转为实收资本会计等式
  • 一个公司两个纳税人识别号
  • 税务编码如何快速查询
  • 装卸费可以抵扣销项税额吗
  • 贷款能不能开发票
  • 租赁场地费入什么科目
  • 银行承兑汇票上的承兑日期
  • 为员工购置小车怎么做账
  • 长期待摊费用账户按用途和结构分类应属于
  • 房地产企业开具零税率发票
  • 初级备考需要多长时间
  • 电子账册需要缴纳印花税的规定是怎么说?
  • 分公司税款
  • 可全额扣除的公益性捐赠支出
  • 福利费进行税额转出
  • 固定资产怎么录入系统
  • 增值税增量留抵退税政策解读
  • 苹果mac dns设置
  • 合并报表同一控制下和非同一控制下区别
  • 以前年度进项税额转出会计分录怎么做
  • 个人所得税和企业所得税都要交吗
  • 预付账款流程
  • mac补丁安装步骤
  • 公司收入可以打折吗
  • 阿里云天池大赛pdf
  • PHP:JewishToJD()的用法_日历函数
  • 行政事业单位 银行
  • 前端面试题目100及最佳答案
  • ElementUI中<el-form>标签中 ref、:model、:rules 的作用
  • python 批量
  • 哪些可以计入研发费用
  • 以前年度损益调整结转到本年利润吗
  • 什么是企业的应付账款
  • 对外捐赠会计分录怎么写
  • 网络编程知识
  • 车辆保险费怎么入账
  • 差额纳税的劳务派遣安保服务征收率
  • 差额征税可以开专票抵扣吗
  • 企业所得税包含员工工资吗
  • 企业低值易耗品的摊销方法有
  • 货运代理费计入什么科目
  • 发票丢失一张罚款标准
  • 无形资产加计扣除怎么算举例
  • 房地产会计开发工资高吗
  • 预缴增值税需要提供什么资料
  • 会计分录结转进项怎么算
  • 技术员差旅费计入哪个会计科目
  • 结转清理净损失怎么算
  • 发票抬头注意事项
  • 没有发票就不能保修吗
  • 公司注销剩余的存货怎么处理
  • 一年不到
  • sql server临时表创建语句
  • win8怎么添加我的电脑到桌面
  • ubuntu15.04安装教程
  • linux swap和mem
  • linux系统的
  • win10系统无法进入
  • windows 10移动版
  • win10语音控制电脑
  • 怎样从零开始
  • javascript操作dom对象
  • JavaScript instanceof 的使用方法示例介绍
  • jquery弹出div窗口
  • 深入理解计算机系统
  • javascript操作网页
  • easyui-dialog
  • 地方税务局怎么查企业信息
  • 生育津贴是分期的吗
  • 海口税务服务大厅
  • 吉林省税务局发票流向查询系统
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设