Comment puis-je obtenir un textview pour apparaître au-dessous d'un autre textview? Android
Je suis la construction d'une petite application android et je veux afficher du texte sous une textview.Je n'arrive pas à l'obtenir. Au moment où le texte est à la droite de l'élément de la liste. Je veux l'afficher avec l'id, "list_size" pour être en dessous du titre. Voici le code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:background="?android:attr/activatedBackgroundIndicator"
>
<!--suppress AndroidLintContentDescription -->
<ImageView android:id="@+id/imageone"
android:layout_width="@dimen/list_item_image"
android:layout_height="@dimen/list_item_image"
android:layout_centerVertical="true"
android:scaleType="fitXY"/>
<TextView android:id="@+id/title" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:fontFamily="sans-serif-light"
android:textIsSelectable="false" android:layout_marginLeft="7dp"
android:layout_toRightOf="@+id/imageone" android:textSize="@dimen/medium_text_size"
android:singleLine="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/divider"/>
<View android:id="@+id/divider"
android:layout_toLeftOf="@+id/list_size"
android:layout_width="1dp"
android:layout_height="10dp"/>
<TextView android:layout_marginLeft="5dp"
android:id="@+id/list_size" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:textSize="@dimen/small_text_size"
android:singleLine="true" android:fontFamily="sans-serif-light"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
OriginalL'auteur user2659645 | 2013-08-12
Vous devez vous connecter pour publier un commentaire.
Vous aurez envie d'utiliser
android:layout_below
OriginalL'auteur Jon
Ce sujet:
OriginalL'auteur Chris J Kikoti
OriginalL'auteur Sushil
Mais vous mettez le à la droite de la mère. Si l'autre ne l'est pas, c'est juste mettre ce textview dessous de l'autre, mais ne sont pas alignés!
Voir mise à jour du code
ok. Comment puis-je obtenir à aligner directement en dessous?
utilisez ceci : android:layout_alignLeft="@id/titre"
Je voudrais utiliser
android:layout_toLeftOf="@+id/divider"
comme pour les autres TextViewOriginalL'auteur Stefano Munarini
vous pouvez mettre des valeurs numériques dans layout_width et également utiliser android:layout_alignTop dans votre deuxième Textview de donner l'id du 1er Textview..
OriginalL'auteur hRb