J'ai besoin mise en page qui montre:mise en page Android: TextView sur le côté droit de la TextView
- Si cl__tv_team_name a court texte, il montre (Q) signe à côté de cl__tv_team_name (cl__tv_team_name et (Q) signe sont à côté de l'autre)
- Si cl__tv_team_name a long texte, textview il montre avec deux lignes ou plus, mais (Q) signe est encore visible sur le côté droit
Simple LinearLayout
ne fonctionne pas. TextView cl__tv_team_name prend toute la largeur.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/cl__tv_team_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="asdfa asdfasf asdf asdf asf dsafasd fads fasdf asdfsad asdf dsaf asfd safa" />
<TextView
android:id="@+id/cl__tv_q_sign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(Q)" />
</LinearLayout>
J'ai aussi essayé RelativeLayout
sans effet approprié:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<TextView
android:id="@+id/cl__tv_team_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:text="asdfa asdfasf asdf asdf asf dsafasd fads fasdf asdfsad asdf dsaf asfd safa" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/cl__tv_team_name"
android:layout_toRightOf="@+id/cl__tv_team_name"
android:text="(Q)"
android:textSize="13sp" />
</RelativeLayout>
C'est ce que je voulais réaliser. Je n'ai pas eu le temps d'apprendre la mise en page des contraintes, merci pour votre code. – AppiDevo
Encore une question, Est-il possible de centrer (Q) verticalement? Donc, il sera placé entre la première et la deuxième ligne de la première vue. – AppiDevo
Oui. Pour ce faire, en imposant le haut de 'q' au haut de' text', et le bas au 'text's du bas. Supprime la contrainte de base. –