activity_main.xml文件<RelativeLayout 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" >    <TextView
        android:id="@+id/txt_title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="标题"
        android:textSize="32dip" />    <include
        android:layout_below="@+id/txt_title"
        layout="@layout/part" /></RelativeLayout>
part.xml文件<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >    <TextView
        android:id="@+id/txt_content"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="具体内容" /></RelativeLayout>
显示效果如下:
我想要的是part整个布局在txt_title下面,请问这个是怎么回事?

解决方案 »

  1.   

    android:layout_below="@+id/txt_title"意思就是在 txt_title下面
      

  2.   

    android:layout_below="@+id/txt_title" 这个对include无效的,要打到这个效果,需要加一个布局。比如:
    <RelativeLayout android:layout_below="@+id/txt_title" 
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
         <include layout="@layout/part" />
    </RelativeLayout>
      

  3.   

    在include标签里面按ALT+/,出来的就是支持的属性其他属性写上去不会报错,但也不会生效
      

  4.   

     android:layout_below="@id/txt_title""@+id/txt_title” 是定义ID 给分
      

  5.   

    顶 2L 、 3L 。    解析时,只会解析 <include android:layout_weight android:layout_height android:id>这三个Attribute        其他的貌似都不会解析了,也就是无效。
      

  6.   

    android:layout_below="@+id/txt_title"
    应改为android:layout_below="@id/txt_title"