Search code examples
androidimageviewuiimageviewscale

Android ImageView scaling


I am using google graph to get the desired graph for me and display it on a android device.

Now I want to display the received graph on a tablet screen but google graph api supports only 300,000 pixels as a max size (width x height) graph. I am making a request for 500 x 600 px image and display it on a ImageView. I set the scaleType to fitXy and give the imageView width=fill_parrent height=850dpi because I want the image to almost fill the screen.

The problem is that the background of the image goes light gray or blurring after the ImageView scales the image and it looks bad on the white background of my application... If I make the ImageView wrap_content on width and height the graph has white background.

Is there any way to get the image displayed without changing it's background color? Please note that I don't want to change the image's size.


Solution

  • I'd recommend to instead use width match_parent and then setAdjustViewBounds=true If that doesn't fix it you probarbly have to change the image.