使用inlcude把一个布局插入到另一个布局中去
2014-05-26 15:34
162 查看
这个用法还是相当有用的,除了可以分工明确之外,也可以防止布局文件过大。
actvity_main.xml:
img_layout:
text_layout:
actvity_main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" > <include android:id="@+id/my_img_layout" layout="@layout/img_layout" /> <include android:id="@+id/my_text_layout" layout="@layout/text_layout" /> </LinearLayout>
img_layout:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/news_small_default" /> </LinearLayout>
text_layout:
<?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="hello,you" /> </merge>效果:
相关文章推荐
- 【Sql Server】使用触发器把一个表中满足条件的数据部分字段插入到另一个表中
- 每天一道LeetCode-----使用最少的操作将一个字符串转换成另一个字符串,只有插入,删除,替换三种操作
- 游标的使用-检索一个表的数据,插入到另一个表中
- 在一个文件中插入另一个文件-sed命令使用
- 在一个文件中插入另一个文件-sed命令使用
- 将一个表的数据插入到另一个表中
- SQL Server:使用一个语句块插入多条记录
- 数据库操作,一个表插入到另一个表中(来源csdn)
- 一个表的信息插入到另一个表里面,如果遇到重复的就覆盖
- struts一个action使用另一个action中的函数
- 单击gridview控件外部的一个按钮,获取gridview中的一列数据,获得的数据插入到另一个表中
- [转] 用ROW_NUMBER()实现取指定行的数据 和从一个表中向另一个表中插入数据并实现某字段每行递增
- 把一个表的数据插入到另一个表:INSERT INTO SELECT / SELECT INTO
- Sql 把一个表中某个字段的数据插入到另一个表中
- PHP - Manual手册 - 函数参考 - String 字符串处理函数 - explode使用一个字符串分割另一个字符串
- PHP - Manual手册 - CLXI. String 字符串处理函数 - str_pad使用另一个字符串将一个字符串填充到指定长度
- 一个线程被另一个不相干的线程卡住了 - 不良的使用全局变量的构造函数的习惯
- 把一个表中的row插入到另一个表中时,出现“该行已属于另一个表”错误
- CSS+DIV布局,一个列宽影响另一个列宽,使总宽度自适应(CSS+DIV Layout, one column's width depend on the other's)
- 一个字符串插入到另一个字符串