I have a large Png image file that I would like to display and scroll around it as I can do in a WebView. When I load my activity with the image file into an ImageView the image is displayed in the screen but is too small to read. I guess the Zoom controls will help once the image it is at it's normal size. I have tried using the image in a WebView but I don't want the Url displayed.
Asked
Active
Viewed 5,556 times
4 Answers
5
I've done something similar with a TableLayout. I wrapped it in a ScrollView nested in a HorizontalScrollView and the user is able to scroll around in all directions when my TableLayout takes up more space than what will fit on the screen. I imagine this would work with an ImageView as well. Something like this:
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</ScrollView>
</HorizontalScrollView>

Rich
- 36,270
- 31
- 115
- 154
-
I've tried this but you can only scroll in one direction at once, because two scroll views don't work as one. – Lumis Feb 17 '11 at 16:08
-
@Lumis What if you extended the HorizontalScrollView, and for each touch event you would return false, in order to send it to the scrollView too ? – android developer Apr 20 '13 at 10:52
1
Create your own Custom Scrollable Image View. I have used this in a game, it works, and you can scroll in x, y directions.

f20k
- 3,106
- 3
- 23
- 32
-
I like the look of this! how do i link this to my image? i have made the class and added this code but would i have to make a new activity with the image to use this! i am still getting to grips/learning with android – David Marsh Feb 28 '17 at 16:46
0
You said you tried a WebView
but you don't want the URL displayed? Do you mean that you see an address bar at the top? If so, please see the answer to this question.