Bonjour a tous/tes,
voici le problème que je rencontre actuellement:
Je souhaiterais juste englober deux éléments différents sur un fond arrondi comportant deux couleurs différentes ( le contour du bouton ainsi que l'intérieur) et le tout positionné à droite de l'écran comme ceci:
Je veux donc deux éléments: une image (ImageView) et un texte (TextView) entouré d'un fond blanc avec un bord arrondi violet. Et je ne veux pas utiliser un d'image pour faire le background.
J'ai testé ça:
et voici mon fichier rounded_textview.xml :
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 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/gris_fond"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="9dp" android:paddingRight="9dp" android:paddingBottom="9dp" android:paddingTop="0dp"> <!-- company tel --> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/rounded_textview"> <ImageView android:src="@drawable/phone_picto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@+id/favoris_company_tel" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/favoris_company_tel" android:textSize="17dp" android:paddingTop="5dp" android:textColor="android:textColor="@color/jaune_basique" android:layout_alignParentRight="true"/> </RelativeLayout> </LinearLayout> </ScrollView>
Et j'obtiens ça:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <?xml version="1.0" encoding="utf-8"?> <!-- res/drawable/rounded_edittext.xml --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="2dp" > <solid android:color="@color/violet_fonce"/> <corners android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp"/> </shape>
Le bouton prend toute la longueur de la vue et non juste la longueur de l'icone telephone + text (numéro)..
Merci de m'aider les amis
Partager