1

I've spent the last two days browsing SO to find answers, unsuccessfully. I'm trying to reproduce a Snapchat-like app.

What I have so far

  • A ViewPager composed of 3 fragments.
  • The middle fragment is supposed to display a camera preview, just like Snapchat, on the whole surface (not truly fullscreen but it should cover the entire UI between the status bar and the bottoms buttons)
  • I'm able to display either:
    • The camera preview, with the correct ratio, but not covering its parent View (see picture 1 below)
    • The camera preview, covering its parent View but stretched (wrong ratio)

 What I need

  • Avoid stretching the preview. Possibly, the preview would be cropped on both sides (left and right). See picture 2 below. I guess this is what Snapchat does. Or is there any other way?

What I went through

Requirements

  • I need to use the Camera API version 1, not version 2.
  • Final photos must be taken in 4/3 format, not 16/9.
  • Portrait is forced although pictures can be in landscape or portrait

Thank you

enter image description here

Community
  • 1
  • 1
Romain Pellerin
  • 2,470
  • 3
  • 27
  • 36

0 Answers0