Bonjour à tou-te-s,

J'ai une activity toute simple liée à un fichier xml contenant un scrollview, une ImageView et 1 TextView.

Voici le code xml complet:
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
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical" android:layout_width="fill_parent"
	android:layout_height="fill_parent">
 
	<ImageView android:src="@drawable/header"
		android:layout_width="wrap_content" android:layout_height="wrap_content"
		android:paddingTop="2pt" android:layout_gravity="center" />
 
	<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
 
		<ScrollView android:id="@+id/ScrollView01"
			android:layout_height="fill_parent" android:layout_width="fill_parent">
 
			<TextView android:layout_width="fill_parent"
				android:layout_height="wrap_content" android:text="@string/com_description" />
 
		</ScrollView>
 
	</LinearLayout>
</LinearLayout>
Par contre je souhaite ajouter d'autres TextView entre les balises ScrollView afin de réaliser une mise en page sympa (sous-titre, texte, sous-titre, texte, etc).
Et lorsque j'ajoute un TextView j'obtiens un message d'erreur et je dois fermer l'émulateur.

Le message d'erreur du logcat:
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
02-20 13:39:31.497: ERROR/AndroidRuntime(887): FATAL EXCEPTION: main
02-20 13:39:31.497: ERROR/AndroidRuntime(887): java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.relib.st/fr.relib.st.Com}: java.lang.IllegalStateException: ScrollView can host only one direct child
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at android.os.Looper.loop(Looper.java:123)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at android.app.ActivityThread.main(ActivityThread.java:3647)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at java.lang.reflect.Method.invokeNative(Native Method)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at java.lang.reflect.Method.invoke(Method.java:507)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-20 13:39:31.497: ERROR/AndroidRuntime(887):     at dalvik.system.NativeStart.main(Native Method)
02-20 13:39:31.497: ERROR/AndroidRuntime(887): Caused by: java.lang.IllegalStateException: ScrollView can host only one direct child
Je crains comprendre que je ne peux insérer qu'un seul TextView entre les 2 balises ScrollView.

Comment faire pour avoir plusieurs TextView dans son activity et pouvoir scroller ?

Merci