1、 include标签只有layout属性是必须的
2、include标签若指定了ID属性,而你的layout也定义了ID,则你的layout的ID会被覆盖
3、在include标签中所有的android:layout_*都是有效的。
但前提是必须要写layout_width和layout_height两个属性,否则无效 。
<include
android:id="@+id/include"
layout="@layout/xml.xml" />
include要引用的那个xml:xml.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
</LinearLayout>
本文详细介绍了Android开发中使用include标签来复用XML布局的方法。包括include标签的基本属性layout及注意事项,例如必须指定layout_width和layout_height等。
777

被折叠的 条评论
为什么被折叠?



