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?

irl_irl
  • 3,785
  • 9
  • 49
  • 60

4 Answers4

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);
JRL
  • 76,767
  • 18
  • 98
  • 146
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

James Moore
  • 2,501
  • 6
  • 26
  • 29
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.

thinuwan
  • 631
  • 2
  • 8
  • 20
-1

Try to put scroll into xml layout with your image