位置: 编程技术 - 正文

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)

  • 月末计提无形资产的折旧
  • 企业裁员补偿金标准是多少
  • 员工餐费用应该怎么记账
  • 开了农民工资金专户必须使用吗
  • 个体工商户网上注销
  • 增值税扣费
  • 购进货物的发票是外来凭证吗
  • 财务合理化建议例子
  • 个人动产租赁所得税税率表最新
  • 代收税款
  • 佣金付给别人公司违法吗
  • 海关进口关税专用缴款书可以抵扣吗
  • 进项税小于销项税怎么处理
  • 分公司开票怎么做账
  • 在建工程预付款项记入什么会计科目
  • 挂靠的项目税务局怎么交地税?
  • 企业所得税报表模板
  • 定额发票验旧是什么意思
  • 旅游业营改增差额征税的会计核算怎么做?
  • 变更办税人信息在哪变更
  • 到期一次还本付息债券
  • 所得税亏损财务处理办法
  • 委托加工费的增值税计入成本吗
  • 企业装修期间开工怎么办
  • 撤销申报增值税流程
  • 收到挂靠方应缴纳税款如何做账?
  • 房地产转让的条件
  • Radio.exe - Radio是什么进程 有什么用
  • 对公网银数字证书
  • mac教程视频
  • 品质扣款单
  • 结转损益类收入科目的余额会计分录
  • 保险中介手续费规定最新
  • 代开专用发票的流程资料要求
  • 应纳所得税额税率表
  • 今日清明节的下一句是什么
  • 职工教育经费可以有余额吗?
  • 期末余额跟年初余额是什么意思
  • 填报的资产总额在季初和季末存在差异是什么意思
  • 浏览器本地存储的方式
  • 二维码的实现原理和实现过程
  • 应付款项怎么填列
  • 印花税应计入什么
  • phpcms模块
  • 银行承兑是什么意思
  • 信息技术服务所得税税负率多少
  • 购买农产品取得增值税普通发票可以抵扣吗
  • 差旅费津贴与差旅费补助
  • 财务报表年报和汇算清缴的顺序
  • 退税是上一年交的税都会退吗
  • 小企业会计准则和一般企业会计准则的区别
  • 帝国cms专题
  • 已经抵扣的发票红字信息表怎么开
  • 公司的货款直接转给股东个人了,该怎么转到公司
  • 领用库存商品用于生产产品
  • 库存商品过期了还能用吗
  • 别人借我的对公账户打钱
  • 销售软件产品
  • 购进商品售价金额核算
  • 补开以前年度发票
  • 宾馆纳税怎么算的
  • sqlserver over
  • mysql从5.7升级至8.0
  • mysql基本sql语句大全(基础用语篇)
  • u盘启动盘如何克隆另外u盘
  • centos7挂载cdrom
  • lol进入游戏后电脑没声音
  • SMceMan.exe - SMceMan进程是什么意思
  • csrss exe
  • symtray.exe - symtray是什么进程 有何作用
  • cocos2dx性能优化与包体优化
  • 安卓 游戏软件
  • 浅析学校德育的个体智能发展功能
  • pycharm中连接MySQL数据库
  • 解决问题
  • shell脚本调用脚本
  • python class
  • unity如何导出vr项目
  • 土地整治税率是多少
  • 关于税制的问题
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设