私はRelativeLayout
にはImageView
、次に右側にTextView
と表示されています。 TextView
は、APIを介してウェブサイトからダウンロードされるため、コンテンツは毎回異なるでしょう。2つのビュー(または最下位のビュー)の下にビューを配置
私は別のTextView
をこの2つの下に置いておきたいですが、TextView
の長さがImageView
より小さい場合は問題があります。この場合、下部のTextView
は、TextView
が右上のTextView
の下になるように調整するため、下部のと重複します。
何が起こる必要があるのは、最も低いビューの下で、下部のTextView
を整列できるようにすることです。
これは私のレイアウトXMLである:その一番下のTextView
のアンカーとして
<?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>