Bonjour,
Dans ma page, j'ai une ImageView. Celle-ci est grande (1024 x 700) et je veux pouvoir scroller horizontalement et verticalement afin de parcours l'image.
Comment faire ?
Merci pour votre aide
Bonjour,
Dans ma page, j'ai une ImageView. Celle-ci est grande (1024 x 700) et je veux pouvoir scroller horizontalement et verticalement afin de parcours l'image.
Comment faire ?
Merci pour votre aide
Bonjour,
Soit :
1/ Tu peux soit ajuster l'image à l'écran avec2 / Sinon dans ton layout tu encadres ton ImageView par un ScrollView
Code : Sélectionner tout - Visualiser dans une fenêtre à part android:adjustViewBounds="true"
3 / Ou tu peux créer une nouvelle class TonImageView.class où dans le onDraw tu gères le scroll de l'utilisateur.
En fait j'ai ajouté une scrollView pour encadrer mon image. Mais celle-ci ne scroll que verticalement :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 <ScrollView android:id="@+id/ScrollView01" android:scrollbars="horizontal|vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/img" android:scaleType="center" android:src="@drawable/metro_paris" /> </ScrollView>
C'est possible à partir de l'API 3 avec HorizontalScrollView
http://androiddevblog.blogspot.com/2...roll-view.html
Sinon faut regarder s'il n' y a pas moyen de mettre deux scrollview en forçant une en position horizontale
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"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="fill_parent"> <ImageView android:id="@+id/tonimageview"></ImageView> </HorizontalScrollView> </ScrollView>
Merci ça fonctionne avec une horizontalScrollView
Partager