Bonjour à tous,
J'ai un fichier XML décrivant la partie supérieure (2 boutons) et la partie inférieure (framelayout) de mon écran :
Je voudrais savoir si c'est possible de changer la valeur du paramètre layout du <include> dans le code java ? Je voudrais afficher le layout fenetre_erase.xml puis sur un clic d'un bouton afficher un autre layout fenetre_toto.xml à la place de fenetre_erase.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
34 </FrameLayout> <ImageView android:id="@+id/IdButton1" android:src="@drawable/icon_button1" android:onClick="ouvreLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="100px" android:layout_marginLeft="200px" /> <ImageView android:id="@+id/IdButton2" android:src="@drawable/icon_button2" android:onClick="ouvreLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="100px" android:layout_marginLeft="400px" /> <FrameLayout android:id="@+id/IdLayoutGenerique" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="250px"> <include android:id="@+id/erase" layout="@layout/fenetre_erase" /> </FrameLayout> </FrameLayout>
Partager