Bonjour à tous,
J'aimerais savoir comme faire pour mettre un TextView sur une ImageView comme ceci :
![]()
Bonjour à tous,
J'aimerais savoir comme faire pour mettre un TextView sur une ImageView comme ceci :
![]()
En utilisant un RelativeLayout peut être.
J'ai utiliser un FrameLayout. Mais comment puis-je ajouter un effet d'opacité au LinearLayout qui contient mon TextView ?
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 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/imagina_article" android:layout_width="fill_parent" android:layout_height="180dp" /> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#000000"> <TextView android:id="@+id/titre_article" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="13dp" /> </LinearLayout> </FrameLayout>
Je n'ai pas du comprendre la question, mais je vais essayer d'y répondre quand même.
Ben là t'es déjà opaque à fond.
Si tu veux augmenter de la transparence dans une couleur, tu peux l'indiquer au début :
#AARRGGBB
Par exemple, noir :
#000000 ou #00000000
Noir transparent :
#40000000
Encore plus transparent :
#80000000
Enfin si je mélange pas tout, t'essaieras.
Donc imaginons que tu ais créé un fichier dans drawable.
Que dans le RelativeLayout du fond il y a a :
Si par dessus tu mets un TextView avec :
Code : Sélectionner tout - Visualiser dans une fenêtre à part android:background="@drawable/monFond"
Le texte devrait être un peu transparent.
Code : Sélectionner tout - Visualiser dans une fenêtre à part android:textColor="#50000000"
Ouais voilà c'était l'inverse, bon j'avais une chance sur deux, c'est pour ça que j'ai dis d'essayer.
Partager