bonjour
je suis débutant en androïd
j'ai un bug dans ficher main.xml
et j'ai pas bien compris le problem
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 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/questions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/questions" android:textStyle="bold" /> <RelativeLayout android:id="@+id/InnerRelativeLayoutQuestion" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" > <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/radiogroup1"> <RadioButton android:text="@string/data_suf_a" android:id="@+id/Rep1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/txtdatasuf"> </RadioButton> <RadioButton android:text="@string/data_suf_b" android:id="@+id/Rep2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/txtdatasuf"> </RadioButton> <RadioButton android:text="@string/data_suf_d" android:id="@+id/Rep4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/txtdatasuf"> </RadioButton><RadioButton android:text="@string/data_suf_c" android:id="@+id/Rep3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/txtdatasuf"> </RadioButton> <RadioButton android:text="@string/data_suf_e" android:id="@+id/Rep5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/txtdatasuf"> </RadioButton> </RadioGroup> </RelativeLayout> <RelativeLayout android:id="@+id/InnerRelativeLayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" > <Button android:text="Next" android:id="@+id/Next" android:layout_alignParentRight="true" android:layout_width="wrap_content" android:layout_height="wrap_content"> </Button> </RelativeLayout> </RelativeLayout>
merci beaucoup
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 package demo.demo; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class demo extends Activity { private static int count; public String[] questions = { "Is x an integer ?\n(1) x/2 is an integer \n(2) 2x is an integer", "What is the value of x ? \n(1)2x + 1=0 \n(2) (x+1)²=x²", "What is the value of 1/k + 1/r ? \n(1) k+r = 20 \n(2) kr = 64" }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView quest = null ; Button btn = null ; if (count<3){ quest.setText(count + " " + questions[count]); } else{ quest.setText(count + " questions " ); } btn.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { newActivity(); } }); } public void newActivity (){ Intent i = new Intent(); i.setClass(this, demo.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); count++; } }
Partager