位置: 编程技术 - 正文

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)

  • 汽车增值税是企业交给国家的税
  • 发票的规格和型号有哪些
  • 增值税交错了退税怎么退
  • 变更了公司名称以前的发票还可以抵扣吗
  • 出租房屋确认收入列简易计税还是销项税
  • 民办幼儿园提供什么服务
  • 商贸企业出口退税计算公式
  • 冲销上月收入
  • 怎么调整应收账款账龄
  • 包装材料报废后如何做会计核算?
  • 职工旅游费计入什么科目
  • 实收资本的账务处理题目
  • 增值税专票的收款人必须是个人嘛
  • 定额发票使用年限规定
  • 付款时收到应收票据会计分录怎么做?
  • 挂靠公司代收入税金如何做分录?
  • 食堂外包服务费可以抵扣进项税吗
  • 进项发票认证抵扣时间是每月的15号吗
  • 股东净利润是什么
  • 财付通转出的钱能还回来吗
  • 负债清偿损益明细表可以0报么
  • 失控发票补完税还追究吗
  • 小微企业 记账
  • windows7部分的更新安装失败怎么办?
  • wordpress主题0skr
  • 政府补助开票怎么申报增值税
  • PHP:ftp_nb_continue()的用法_FTP函数
  • win7旗舰版系统鼠标不能动了
  • win7系统文件在哪里可以找到
  • 应付债券的会计处理例题
  • 基建会计和建筑会计的区别
  • 财政发票可以报销吗
  • 商贸企业小规模税率是多少
  • 房屋租金应缴纳多少
  • 软件开发企业进项税额抵扣
  • qr code在线生成二维码
  • 资产负债表中的货币资金怎么算
  • 原生js实现promise.all
  • 财务软件服务合同要交印花税吗
  • 纳税人识别号的英文缩写
  • sqlserver调度
  • mysql的my.ini配置
  • 工会经费计税依据是应发还是实发
  • 房地产项目公司组织架构
  • 检验费用会计分录
  • 员工奖励的现金有哪些
  • 权益净利率如何分析
  • 房地产成本的概念
  • 自己开发建造的房屋
  • 应收票据背书转让分录
  • 暂估入库一直未取得发票需要调账吗
  • 车间管理人员的福利费计入什么科目
  • 小规模增值税减免申报表怎么填
  • 会议服务公司名称大全
  • sql server多行添加
  • sqlserver怎么用
  • ug实体命令怎么使用
  • xp系统电脑设置在哪
  • 组策略 guest
  • 安装solaris11
  • windows8关机在哪里
  • Linux系统配置要求
  • centos6.5无法启动
  • 笔记本w8系统怎么取消开机密码
  • 升级win102004
  • pax是什么文件
  • windows聚焦失效
  • Linux磁盘配额步骤
  • 体验Win8灵活分屏贴靠功能图文介绍
  • unity加密解决方案
  • jquery焦点
  • Android 水平居中
  • Python 中urls.py:URL dispatcher(路由配置文件)详解
  • flask框架菜鸟教程
  • 创业要看的书
  • shell中大括号
  • unity3d中用四元数 Quaternion来对一个坐标点进行旋转的初步体会
  • unity struct
  • gradle 混淆
  • blueerdos和鄂尔多斯区别
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设