Android优化——UI优化(二)
来源:互联网 发布:c语言学生综合测评系统 编辑:程序博客网 时间:2024/06/03 16:16
使用include
标签复用布局
- 1.include
标签的作用
假如说我下图的这个布局在很多界面都用到了,我该怎么办?每个页面都写一遍的话,代码太冗余,并且维护难度加大。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical"> <include layout="@layout/activity_clude_item"/> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="这是中间的东西"/></LinearLayout>
上边的这个布局我就用的
include
标签,代码显然更加的整洁,并且增加的布局的复用性,降低了app的使用内存
- 2.include
标签的用法
<include layout="@layout/activity_clude_item"/>
其中我们使用
layout="@layout/activity_clude_item"
设置复用的布局文件
0 0
- Android优化——UI优化(二)
- Android优化UI(二)
- Android性能优化——UI优化
- Android UI性能优化(二)
- Android优化——UI优化(一)
- Android优化——UI优化(三)
- Android优化——UI优化(四)
- Android产品研发(二十一)-->Android中的UI优化
- Android产品研发(二十一)-->Android中的UI优化
- Android优化(二)——代码优化
- Android性能优化调研——UI布局优化
- Android 性能优化——UI 优化指南
- Android开发优化之—界面UI的优化
- android UI进阶之布局的优化(二)
- android UI进阶之布局的优化(二)
- android UI进阶之布局的优化(二)
- 【Android 性能优化】—— UI篇
- Android UI性能优化—理论篇
- 46dn534
- sed命令
- er432yr
- BZOJ3624【生成树】
- 43arew352asr436346
- Android优化——UI优化(二)
- 5sr43rsd43
- 43aewf4gs54
- 5sg4sdf32
- CMake 实例学习(一) 开始
- 弹幕小demo
- 462dsaf345454
- 2343
- Eclipse: install new software could not find jar file