Android 使用<;包括>;相对地

Android 使用<;包括>;相对地,android,android-layout,Android,Android Layout,我有一个亲戚,有一个孩子是 像这样root.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"

我有一个亲戚,有一个孩子是

像这样
root.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     android:orientation="horizontal">
<include layout="@layout/another.xml"/>
</RelativeLayout>
基本上,我希望我的
另一个.xml中的所有视图都与我的根对齐。
我已经在上面尝试过了,但是我的另一个.xml中的视图与我的根对齐


谢谢。

不。你必须做类似的事情,方向仅适用于线性布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >


    <RelativelLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true" >
    <include layout="@layout/another.xml" />
    </RelativelLayout>

</RelativeLayout><RelativeLayout>

</RelativeLayout>

不。您必须这样做,并且方向仅适用于线性布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >


    <RelativelLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true" >
    <include layout="@layout/another.xml" />
    </RelativelLayout>

</RelativeLayout><RelativeLayout>

</RelativeLayout>