我有一个RelativeLayout
,其左侧为ImageView
,右侧为TextView
。 TextView
是通过他们的API从网站下载的,因此它的内容每次都会有所不同。在两个视图(或最低视图)下定位视图
我想有另一TextView
这两个下方,但我有一个问题,当TextView
长度小于ImageView
。发生这种情况时,底部的TextView
将与ImageView
重叠,因为我将底部的TextView
对齐到右上角的TextView
以下。
我需要发生的事情是能够将底部TextView
对齐到最低的视角。
这是我的布局XML:
<?xml version="1.0" encoding="utf-8"?>
<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" >
<ImageView
android:id="@+id/itemImageView"
android:layout_width="100dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:src="@drawable/id_image" />
<TextView
android:id="@+id/itemContentsTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/itemImageView"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:text="Sample contents\nSample contents\nSample contents" />
<TextView
android:id="@+id/itemIdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_below="@+id/itemContentsTextView"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:text="1234" />
</RelativeLayout>