Bonjour,
Je souhaite faire s'enchainer 2 TextView. Intérêt ? Faire que les 2 TextView n'aient pas les même propriétés (gras, taille de la police, etc. ).
J'ai donc mis en place le code suivant :
Ce code fonctionne si la taille des 2 TextView ne dépasse pas l'écran (cf fonctionne.png).
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/current_list_internal" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="0.6" android:layout_marginLeft="0dip" android:background="@color/white" android:orientation="vertical" > <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/current_list_internal2" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_marginLeft="0dip" android:background="@color/white" android:orientation="horizontal" android:layout_weight=".7" > <TextView android:id="@+id/imgViewSub" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TEST qui va fonctionner" android:textColor="@color/black" android:textSize="10dip" android:textStyle="bold" android:background="@color/red1" /> <TextView android:id="@+id/imgViewShortDescrib" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="ceci est un test" android:textColor="@color/black" android:textSize="8dip" android:background="@color/blue1" android:layout_toRightOf="@id/imgViewSub" /> </RelativeLayout> </LinearLayout>
Par contre, si le texte du premier est supérieur à 1 ligne, alors l'affiche explose complètement (cf fonctionne_pas.png).
Voyez-vous un moyen de résoudre ce problème ?
Cordialement.
NB : les couleurs rouge et bleu ne sont présentent que pour l'exemple.
Partager