Bonjour

Voila dans le cadre d'un projet j'ai du créer un assemblage d'image qui ont été ajusté et partiellement superposé, pour cela j'ai du jouer avec les marge dans le xml jusque la pas de problème l'ensemble rend plutôt bien .
Mais voila dans le cadre de mon projet , ces dite image doivent être modifier à l'aide d'un setImageResource(R.drawable.image) mais voila lorsque je le fais mes images ne garde pas leur place et ce déplace (toujours de le même façon );

Alors ma question est double setImageResource touche t'il aux marges(de l'image concerné ou celle qui en découle)? si oui cela veux dire qu'il faudra que je déclare toute mes marges à chaque modification.
Si c'est pas le cas est il possible que l'application perde les référants entre les images (ex: android:layout_alignTop="@+id/imageView10") lors du changement?

ha oui j'ai vérifier i les images avant - après font bien exactement la même taille et dans l'exemple passer en image j’appelle la même image
pour la section de code .java concerné c'est très simple

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
dalle2.setOnClickListener(new OnClickListener() {
 
				@Override
				public void onClick(View v) {
 
					dalle1.setImageResource(afficheImage(centre,1));
					dalle2.setImageResource(afficheImageCote(cote,1));
	                       }
 
			});
voici le code de mon xml et la capture d’écran avant après

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >
 
    <RelativeLayout
        android:id="@id/relativeLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true" >
 
        <ImageView
            android:id="@+id/ImageView01"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignLeft="@+id/imageView27"
            android:layout_below="@+id/imageView27"
            android:layout_marginTop="23dp"
            android:src="@drawable/iconflechegauche" />
 
        <Button
            android:id="@+id/Save"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignBaseline="@+id/Recap"
            android:layout_alignBottom="@+id/Recap"
            android:layout_marginTop="23dp"
            android:background="@drawable/boutonsave"
            android:layout_toLeftOf="@+id/imageView28" />
 
        <TextView
            android:id="@+id/TextView01"
            android:layout_width="60dp"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/ImageView01"
            android:layout_alignLeft="@+id/textView1"
            android:text="Bois"
            android:textAppearance="?android:attr/textAppearanceLarge" />
 
        <ImageView
            android:id="@+id/imageView28"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:src="@drawable/iconhome" />
 
        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@+id/Save"
            android:layout_alignLeft="@+id/ImageView01"
            android:src="@drawable/borne02_occlu_all" />
 
        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/imageView1"
            android:layout_alignLeft="@+id/imageView1"
            android:layout_marginBottom="121dp"
            android:layout_marginLeft="1dp"
            android:src="@drawable/borne02_bois_dalle_ext_01" />
 
        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/imageView2"
            android:layout_alignLeft="@+id/Recap"
            android:layout_marginBottom="41dp"
            android:src="@drawable/borne02_bois_dalle_ext_02" />
 
        <ImageView
            android:id="@+id/imageView5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView3"
            android:layout_alignTop="@+id/imageView2"
            android:layout_marginLeft="3dp"
            android:layout_marginTop="27dp"
            android:src="@drawable/borne02_bois_dalle_ext_04" />
 
        <ImageView
            android:id="@+id/imageView6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/imageView3"
            android:layout_marginLeft="4dp"
            android:layout_marginTop="25dp"
            android:layout_toRightOf="@+id/imageView2"
            android:src="@drawable/borne02_bois_dalle_ext_05" />
 
        <ImageView
            android:id="@+id/imageView7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@+id/imageView5"
            android:layout_marginBottom="-16dp"
            android:layout_marginLeft="0dp"
            android:layout_toRightOf="@+id/imageView3"
            android:src="@drawable/borne02_bois_dalle_ext_06" />
 
        <ImageView
            android:id="@+id/imageView8"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/imageView6"
            android:layout_marginBottom="30dp"
            android:layout_marginLeft="30dp"
            android:layout_toRightOf="@+id/Recap"
            android:src="@drawable/borne02_bois_dalle_ext_07" />
 
        <ImageView
            android:id="@+id/imageView9"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/imageView2"
            android:layout_marginLeft="6dp"
            android:layout_marginTop="16dp"
            android:layout_toRightOf="@+id/imageView5"
            android:src="@drawable/borne02_bois_dalle_ext_08" />
 
        <ImageView
            android:id="@+id/imageView10"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/imageView3"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="16dp"
            android:layout_toRightOf="@+id/imageView6"
            android:src="@drawable/borne02_bois_dalle_ext_09" />
 
        <ImageView
            android:id="@+id/imageView13"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignRight="@+id/imageView1"
            android:layout_alignTop="@+id/imageView2"
            android:layout_marginLeft="-2dp"
            android:layout_marginTop="7dp"
            android:src="@drawable/borne02_bois_dalle_ext_012" />
 
        <ImageView
            android:id="@+id/imageView15"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView5"
            android:layout_alignTop="@+id/imageView3"
            android:layout_marginLeft="6dp"
            android:layout_marginTop="4dp"
            android:src="@drawable/borne02_bois_dalle_int_02" />
 
        <ImageView
            android:id="@+id/imageView16"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView6"
            android:layout_alignTop="@+id/imageView4"
            android:layout_marginRight="1dp"
            android:layout_marginTop="3dp"
            android:src="@drawable/borne02_bois_dalle_int_03" />
 
        <ImageView
            android:id="@+id/imageView17"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignRight="@+id/imageView5"
            android:layout_alignTop="@+id/imageView5"
            android:layout_marginRight="10dp"
            android:layout_marginTop="5dp"
            android:src="@drawable/borne02_bois_dalle_int_04" />
 
        <ImageView
            android:id="@+id/imageView18"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/imageView6"
            android:layout_marginLeft="25dp"
            android:layout_marginTop="5dp"
            android:layout_toRightOf="@+id/Recap"
            android:src="@drawable/borne02_bois_dalle_int_05" />
 
        <ImageView
            android:id="@+id/imageView19"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView7"
            android:layout_alignTop="@+id/imageView7"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="4dp"
            android:src="@drawable/borne02_bois_dalle_int_06" />
 
        <ImageView
            android:id="@+id/imageView20"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignRight="@+id/imageView8"
            android:layout_below="@+id/imageView14"
            android:layout_marginRight="10dp"
            android:src="@drawable/borne02_bois_dalle_int_07" />
 
        <ImageView
            android:id="@+id/imageView21"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView9"
            android:layout_below="@+id/imageView15"
            android:layout_marginLeft="10dp"
            android:src="@drawable/borne02_bois_dalle_int_08" />
 
        <ImageView
            android:id="@+id/imageView16"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignParentTop="true"
            android:layout_marginTop="28dp"
            android:layout_toLeftOf="@+id/imageView25"
            android:src="@drawable/iconflechedroite" />
 
        <ImageView
            android:id="@+id/imageView27"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignTop="@+id/imageView16"
            android:layout_marginRight="22dp"
            android:layout_toLeftOf="@+id/imageView3"
            android:src="@drawable/iconflechegauche" />
 
        <TextView
            android:id="@+id/textView1"
            android:layout_width="60dp"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/imageView27"
            android:layout_alignLeft="@+id/imageView18"
            android:text="Bois"
            android:textAppearance="?android:attr/textAppearanceLarge" />
 
        <ImageView
            android:id="@+id/ImageView02"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignBottom="@+id/TextView01"
            android:layout_toLeftOf="@+id/imageView13"
            android:src="@drawable/iconflechedroite" />
 
        <ImageView
            android:id="@+id/imageView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@+id/imageView18"
            android:layout_toRightOf="@+id/imageView2"
            android:layout_marginLeft="-5dp"
            android:src="@drawable/borne02_bois_dalle_ext_03" />
 
        <ImageView
            android:id="@+id/imageView14"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView2"
            android:layout_alignTop="@+id/imageView13"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="-3dp"
            android:src="@drawable/borne02_bois_dalle_int_01" />
 
        <ImageView
            android:id="@+id/imageView25"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/imageView19"
            android:layout_toRightOf="@+id/ImageView02"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="1dp"
            android:src="@drawable/borne02_bois_dalle_int_012" />
 
        <ImageView
            android:id="@+id/imageView12"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/ImageView02"
            android:layout_below="@+id/imageView10"
            android:layout_marginTop="2dp"
            android:layout_marginLeft="-7dp"
            android:src="@drawable/borne02_bois_dalle_ext_011" />
 
        <ImageView
            android:id="@+id/imageView24"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/imageView18"
            android:layout_toRightOf="@+id/imageView19"
            android:layout_marginTop="2dp"
            android:layout_marginLeft="-2dp"
            android:src="@drawable/borne02_bois_dalle_int_011" />
 
        <ImageView
            android:id="@+id/imageView11"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView21"
            android:layout_below="@+id/imageView21"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp"
            android:src="@drawable/borne02_bois_dalle_ext_010" />
 
        <ImageView
            android:id="@+id/imageView23"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/imageView17"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="1dp"
            android:layout_toRightOf="@+id/imageView4"
            android:src="@drawable/borne02_bois_dalle_int_010" />
 
        <ImageView
            android:id="@+id/imageView22"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/imageView10"
            android:layout_toLeftOf="@+id/Save"
            android:layout_marginTop="5dp"
            android:layout_marginRight="17dp"
            android:src="@drawable/borne02_bois_dalle_int_09" />
 
        <Button
            android:id="@+id/Recap"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="129dp"
            android:background="@drawable/boutonrecap" />
 
    </RelativeLayout>
 
</RelativeLayout>
Nom : image apres.png
Affichages : 119
Taille : 98,8 KoNom : image avant.png
Affichages : 85
Taille : 99,6 Ko