Android RelativeLayout在角点放置对象

Android RelativeLayout在角点放置对象,android,android-layout,Android,Android Layout,我试图在列表视图项的四个角放置4个对象。我使用的是相对布局。由于某些原因,对象仅与左侧对齐。右边应该有两个对象。我也使用重力布局,但没有用。它们都向左对齐 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" androi

我试图在列表视图项的四个角放置4个对象。我使用的是相对布局。由于某些原因,对象仅与左侧对齐。右边应该有两个对象。我也使用重力布局,但没有用。它们都向左对齐

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <include
        android:id="@+id/fromDistanceWindowLayout"
        android:layout_alignParentLeft="true"
        android:layout_gravity="left"
        layout="@layout/include_distance_window" />

    <include
        android:id="@+id/toDistanceWindowLayout"
        android:layout_alignParentRight="true"
        android:layout_gravity="right"
        layout="@layout/include_distance_window" />

    <include
        android:id="@+id/fromTimeWindowLayout"
        android:layout_alignParentLeft="true"
        layout="@layout/include_time_window" />

    <include
        android:id="@+id/toTimeWindowLayout"
        android:layout_alignParentRight="true"
        layout="@layout/include_time_window" />

Include_distance_window.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/distancebackground"
            android:layout_alignParentTop="true" />

        <TextView
            android:id="@+id/distanceWindow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true" />
    </RelativeLayout>

包括时间窗口

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:src="@drawable/distancebackground" />

<TextView
    android:id="@+id/timeWindow"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true" 
    android:text="123"/>


编辑: 如果我将第二个include替换为include xml的内容,那么一切都可以正常工作

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_height="wrap_content">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/distancebackground"
        android:layout_alignParentTop="true" />

    <TextView
        android:id="@+id/distanceWindow"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />
</RelativeLayout>


我想知道为什么?有一件事我想指出。布局重力对相对布局没有影响。它是线性布局的一个参数。第二,如果您使用的是EclipseIDE,请检查图形布局。我想知道你是否能看到所有相关的布局?我想您可以尝试给出一些确定的值,比如70dp,而不是为相对布局提供包装内容。请尝试这些,tinker,并让我知道更改。

智能更改。是的,这很重要,孩子们确实开始在角落里做了。是的,地心引力没有什么不同。我刚刚完成了类似的事情。乐意帮忙:D.时机和情况。