I would recommend using a custom view class that extends ImageView,
with the scaleType set to Matrix.
You can then implement a custom OnTouchHandler (override the onTouch
event in your custom view) and use this to alter the position of the
image using myView.setImageMatrix(matrix). This will allow you to pan/
drag the image, and even implement pinch-zoom.

e.g. For a drag you'll want to change the matrix using
matrix.postTranslate(dx, dy) - there's an article on ZDNet about multi-
touch (you can ignore the pinch-zoom bits if you'd like) that gives a
better idea of how to use a Matrix to translate/scale an image.

I'd recommend using http://code.google.com/p/android-multitouch-controller/
to make your life easier, even if you don't implement pinch-zoom.

I tried the WebView method in an application I a developing and
rejected it for several reasons:
1) Performance is poor compared to the custom view method. Loading a
WebView incurs a lot of overhead for the simple task of displaying an
image
2) Repeat calls to setData in a short period of time seem to fail
without error, at least in combination with a ContentProvider (I was
displaying images from the SD card). In my program this mean if a user
quickly changed the image to be displayed, sometimes just a white page
would be displayed.
3) You don't get any fine control over your image.

Although it will take longer (give yourself a few days to get a really
good implementation working) I really would recommend the custom view
and MultiTouchController - you don't have to implement pinch zoom if
you don't want.

If you do go this way and want pinch-zoom let me know, as I have a
modification to Luke Hutch's code which enables multi-touch on stock
Android 1.5 (and possibly 1.6 devices - have not tested yet) meaning
you can have pinch-zoom on pretty much any phone.

Regards,
Joe

On Jul 14, 12:07 am, Tommy <[email protected]> wrote:
> Hi everyone,
>
> I have animagethat I want to be able to displayfullsizebut when I
> place it in my imageview it scales. I would like it to 
> displayfullsizewithscrollbars. Is there a way I can make my main view that 
> theimageview is in havescrollbars vertical and horizontal or how can I
> do this. The images are local on the SD card. I would really like to
> get the same effect that the webview offers if i were to look at 
> theseimagefrom a URL.
>
> Thanks for your help,
>
> Tommy

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to