Mam RelativeLayout
z ImageView
po lewej stronie, a następnie TextView
po prawej stronie. Numer TextView
jest pobierany z witryny internetowej za pośrednictwem interfejsu API, dzięki czemu jej zawartość będzie za każdym razem inna.Pozycjonowanie widoku pod dwoma widokami (lub najniższym widokiem)
Chcę mieć kolejny TextView
pod tymi dwoma, ale mam problem, gdy długość TextView
jest mniejsza niż . Gdy tak się stanie, TextView
u dołu będzie nakładać się na ImageView
, ponieważ wyrównuję dolną linię TextView
, aby znajdowała się poniżej TextView
w prawym górnym rogu.
Muszę się zdarzyć, aby wyrównać dno TextView
pod dowolnym widokiem, który jest najniższy.
To mój układ 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>