J'ai un Je veux avoir un autre Ce que je dois arriver est de pouvoir aligner le fond Ceci est ma mise en page xml: p> relativenelayout code> avec un
imageview code> à gauche puis a
textview code> à droite. Le
textview code> est téléchargé à partir d'un site Web via leur API afin que ce contenu soit différent à chaque fois.
textview code> sous ces deux mais j'ai un Problème Lorsque la longueur
textview code> est inférieure au
imageview code>. Lorsque cela se produit, le
textview code> en bas se chevauchera le
imageview code> car j'allonte le fond
textview code> pour être inférieur au
textview Code> en haut à droite. P>
textview code> sous la vue la plus basse. p>
3 Réponses :
envelopper le haut quelque chose comme ça (non testé): p> imageview code> et
textview code> dans un autre
relativelayout code> et utilisez-le comme ancre pour votre bas
textview code>.
Vous devez créer Donc, il sera donc à louer comme ça. P> linearlayout code> comme principal parent et le faire
Orientation: vertical code>. Ensuite, ajoutez d'abord votre
relativenelayout code>, puis ajoutez votre
textview code>.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical" >
<RelativeLayout
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" />
</RelativeLayout>
<TextView
android:id="@+id/itemIdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:text="1234" />
</LinearLayout>
Utilisez un autre il devrait donc être: p>
p> p> p> relativenelayout code> J'ai Testé et texte ne cesse jamais strong>