Keyur Android
Keyur Android

Reputation: 395

How to play video in only landscape mode in android

Here I am developing an application which plays video in only landscape mode. I set my activity orientation to "landscape" in AndroidManifest.xml file, and my video is playing very nice but problem is that I hold my device in Landscape mode, when I rotate my device to 180 angle my video playing is upside down (bottom to top). It is not chaging according to that.

Upvotes: 2

Views: 3697

Answers (3)

Shivam Bhusri
Shivam Bhusri

Reputation: 1171

you can do from manifest file like this:

<activity android:name=".Video" android:screenOrientation="userLandscape">

Upvotes: 1

Ron
Ron

Reputation: 24235

If you are developing for android 2.2 and below you will have to rotate your content view canvas. Here are two similar questions that suggest something like that..

How to display Android UI Elements about 180 degrees rotated

How can you display upside down text with a textview in Android?

Upvotes: 0

Vipul
Vipul

Reputation: 28093

If you are targeting android version 2.3 or greater then use following in onCreate

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);

Upvotes: 5

Related Questions