位置: 编程技术 - 正文

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)

  • 小规模纳税人如何计算增值税
  • 建筑业增值税税负预警
  • 小规模纳税人个税是月报还是季报
  • 个人所得税年度汇算时间
  • 个税汇算清缴为啥要补交
  • 有营业执照有什么好处吗?
  • 长期挂账的应付账款如何写申请报告
  • 装饰行业可否用石灰代替
  • 商业企业月末结转成本
  • 海关完税凭证如何抵扣进项税
  • 融资发票是什么
  • 网银转账手续费标准
  • 地税服务业发票税率多少
  • 我是小规模企业客户要求开专票不开投诉
  • 开采石头要交什么税
  • 淘宝的电子发票怎么看
  • 营改增后如何纳税
  • 金银首饰的消费税税务处理
  • 电子发票已开出客户退款会计处理是怎样的?
  • 空调作为固定资产吗
  • 什么叫非成品油发票
  • 冲红发票开错了怎么办
  • 公司法人的车租赁合法吗
  • 合同作废印花税法规定
  • 维修机器设备买什么好
  • windows7为什么不能用了
  • 网速突然变差是什么原因
  • 服务业公司取得的成果
  • 收到采购发票未开票
  • windows为什么从7开始
  • PHP:mb_convert_variables()的用法_mbstring函数
  • 销售已使用过的固定资产增值税税率
  • php text
  • PHP:getimagesizefromstring()的用法_GD库图像处理函数
  • 生产型企业出口退税退的是哪部分的税
  • 司法拍卖所购的房产
  • 浅水滩怎么样
  • php跳转微信支付
  • nginx安装配置视频
  • vue-cli4创建项目
  • python pyecharts
  • python3.4 numpy
  • 自产自销农产品免税备案取消
  • 中药资源与开发跨专业考研
  • 工费经费计入哪里
  • 修改账本
  • 现金流量表编制原则
  • 核定征税是什么意思
  • 运输中合理损耗计入什么科目
  • 期末留抵税额怎么填报表
  • 企业出售自用车辆的会计处理
  • 建筑业的人工费是什么
  • 其他应付款贷方什么意思
  • 进项税留底怎么处理
  • 高速过路费抵扣增值税
  • 境外劳务输出收费表标准
  • 互联网金融理财产品的优势
  • 土地储备委员会职责
  • 农业机耕属于种植业吗
  • 无形资产摊销费怎么算
  • windows installation disc
  • mysql函数大全以及举例
  • wncloud.exe是什么程序
  • redhat下载教程
  • winxp内存不能为read
  • linux scp远程拷贝文件及文件夹
  • win8系统设置锁屏密码
  • win7没有媒体功能
  • windows适配器未连接
  • windows7手动更新
  • bootstrap怎么用
  • nodejss
  • python算法怎么用
  • javascript的dom
  • python3多态
  • 中国海关化妆品关税
  • 国家税务总局令第43号公告
  • 小规模纳税人开3%专票怎么交税
  • 金融知识宣传的建议
  • 北京国家税务局待遇
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设