1
votes

I have an application which the user can capture images and then send them to the server. I set the image to be as Base64 and then send it to the server.

In the application I have this screens:

  1. Feed
  2. Post Screen
  3. Fullscreen Image (Landscape)

When the user enters to each screen I get from the server a Base64 and decode it to bitmap and set it to be the source of the imageview.

each screen has it's layout. for the feed and post screens I set the imageview width and height to be hardcoded with some dp, and for the fullscreen image I set them to be fill_parent. Now for each imageview I set the scale type to : fitXY, but I see that the pictures are streched and in the fullscreen mode I can see the pixels. I want to set the image to fit the xy but to be smooth as possible

I tried to set the adjustToBound to true and scaleType to cropCenter, fitCenter and etc but it doesn't help.. how can I save the aspect ratio?

1
Please create an MCVE.tachyonflux
try setting android:adjustViewBounds propertyspezzino
@spezzino I already tried that..Elior
@Elior ok, please create an MCVE so we can helpspezzino

1 Answers

0
votes

In order for adjustViewBounds to work, one dimension of the ImageView needs to be set to a hard value like dp value or match_parent, and the other dimension needs to be set to wrap_content. adjustViewBounds will make the wrap_content dimension adjust to be the right size to keep the image's aspect ratio.