2

I have an image that takes up a lot more space than the android screen. I want the image to be presented full size and the user can move in any direction. Like a map.

Any suggestions?

4 Answers 4

3

You can use a webview which gives this to you for free. I'm not sure why but when I tried using the loadData method it didn't work, but using loadDataWithBaseURL with a null URL did.

With a webview your image can even be embedded in HTML. In the example below yourContent is simply a string.

E.g.

yourView.loadDataWithBaseURL(null, yourContent, "text/html", "UTF-8", null);
1
  • Can you send some sode that can do so using bitmap tranferred from server?
    – eyal
    Jul 7, 2011 at 20:07
2

Here is a tutorial I saw that did what you are describing http://www.anddev.org/scrolling_a_picture_horizontally_and_vertically-t3245.html

0
0

You can put your image in an ImageView and wrap it using a ScrollView and a HorizontalScrollView like below.

<HorizontalScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/yourImage"/>

    </ScrollView>

</HorizontalScrollView>

So you can scroll it horizontally and vertically like a map.

-1

Try to put scroll into xml layout with your image

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.