0

In apps like NoCrop an image is made to fit a resolution of 1:1 (made square) by adding some extra spaces at the top and bottom of the image (shown below).

This is a square image, just for and example, although I don't need to make them square, I need to make them rectangular in 16:9 ratio

Similarly, I wish to add some spaces to an image through my Android app, to fit a resolution of ratio, say 16:9. My app creates a video by stitching these images together, and for the video, all the images first need to be converted into a fixed resolution.
I have not used Bitmaps much, nor I am an expert in Android. Any kind of help would be appreciated! :)

huskygrad
  • 1,257
  • 1
  • 10
  • 21

1 Answers1

0

Try adding these to your ImageView in xml:

android:scaleType="centerCrop"
android:adjustViewBounds="true"

This will crop your image so that it fits the ImageView

Jas
  • 3,207
  • 2
  • 15
  • 45