リストビューアイテムの四隅に4つのオブジェクトを配置しようとしています。相対レイアウトを使用しています。何らかの理由で、オブジェクトは左側にのみ整列しています。2つのオブジェクトが右側にあるはずです。私もlayout_gravityを使用していますが、使用していません。それらはすべて左に整列します。
<?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>
include_time_windowを含める
<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"/>
編集:2番目のインクルードをインクルード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>
なんでだろう?