Danijel Marinkovic
Danijel Marinkovic

Reputation: 59

Camera2 API: Keep autorotation on, but don't rotate camera preview and buttons

I am looking for a solution to keep the SCREEN ORIENTATION in auto mode, but that the preview of the camera does not rotate. Any suggestions?

Upvotes: 0

Views: 301

Answers (2)

Eddy Talvala
Eddy Talvala

Reputation: 18107

Use rotation animation SEAMLESS, and implement landscape and portrait UIs that carefully place the preview window in the same place.

Upvotes: 0

Nitin Gurbani
Nitin Gurbani

Reputation: 1240

You need to mention android:screenOrientation="portrait" or android:screenOrientation="landscape" under the activity tag in your manifest file (i.e. AndroidManifest.xml) if you want to make your activity's orientation fixed (this is the activity in which the preview of camera is being shown by you).

Like for example -

<activity
            android:name="com.something.camera.CaptureActivity"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" />

Upvotes: 1

Related Questions