0

I'm creating an app in which on click of listview items I'm showing images. Now the size of those images is generally width:480 and height is variable, most of the time > 800. I'm using ImageView to show those images.

Now if I use simple imageview and show the image as setContentView(R.image), the image fits itself EXACTLY to 480x800 which results in distortion of image content.

I tried to implement suggestions given at Android: Scrolling an Imageview

but again no luck. Here I'm able to get the scrolling of the ImageView but not what I want.

What I want is that the image doesn't change it pixel ratio. It simply shows to the user on the screen (full screen width) and with a vertical scroll to see the content that is beyond the 800 px ratio. Kindly suggest what should I do in ImageView XML and my activity class to achieve the same. Currently i'm implementing everything in Android: Scrolling an Imageview so code is same as it's there.

Community
  • 1
  • 1
Harry
  • 3
  • 2
  • 9

1 Answers1

4

Try wrapping the ImageView in a ScrollView.

And don't forget to set the ImageView's scale type to something like FitXY.

Steven Schoen
  • 4,366
  • 5
  • 34
  • 65
  • Thanks D_Steve. The scrollview thing worked but with one problem..now the image is stretched vertically and is distorted during the display. Any trick to keep the length and width same and still do the scrolling?? – Harry Jul 27 '12 at 04:15
  • It's the scale type. I don't know exactly which one would be best for your application, but try changing it. `FitXY` was an example. `CenterInside` might be good, try that one. Also, mind marking my answer as correct? – Steven Schoen Jul 27 '12 at 20:29