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下面,请问这个是怎么回事?
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下面,请问这个是怎么回事?
<RelativeLayout android:layout_below="@+id/txt_title"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<include layout="@layout/part" />
</RelativeLayout>
应改为android:layout_below="@id/txt_title"