我想将 ImageViews 彼此附加。我试图设置重力和 alignParentRight/alignParentLeft 但无法实现我的目标。为简单起见,我为 ViewGroups 设置了颜色背景。你有什么想法如何完成吗?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/share_dope_max_image_height"
android:layout_marginTop="@dimen/share_dope_margin_3"
android:background="#0DD"
android:orientation="horizontal"
android:paddingLeft="@dimen/share_dope_images_container_horizontal_padding"
android:paddingRight="@dimen/share_dope_images_container_horizontal_padding">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="#D0D"
android:gravity="right"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:src="@drawable/girl3" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="#DD0"
android:gravity="left"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:src="@drawable/girl4" />
</RelativeLayout>
</LinearLayout>