How to change orientation of a single view in app


#1

need single view with landscape orientation only otherwise app should run in portrait mode only.


#2

Yeah. I am also facing the same issue. No Solution found yet.


#3

i have tried doing it by using custom css.
but how can i make the header and footer go in landscape mode.


#4

Check this post.


#5

See this blog post for ideas
http://www.raymondcamden.com/index.cfm/2014/5/24/PhoneGap-Tip-Temporarily-changing-orientation-for-video-in-a-portrait-only-application#more


#6

@darrenahunter @mhartington
Thank you very much, it worked…


#7

Hi @Sudhindra_C, do you still remember how you made it to work? I am facing the same issue, that I want to show a view in the landscape mode. Appreciate it if you could share the solution.


#8

@yli1001 really sorry for the late reply :grin:

Use this plugin as you wish https://github.com/gbenvenuti/cordova-plugin-screen-orientation

Add plugin and use it like this anywhere, a simple if condition in app or config file will your job :
// set to either landscape
screen.lockOrientation(‘landscape’);

// allow user rotate
screen.unlockOrientation();

// access current orientation
console.log('Orientation is ’ + screen.orientation);

cordova plugin add https://github.com/gbenvenuti/cordova-plugin-screen-orientation


#9

Thanks a lot. Worked for me too :slight_smile:


#10

Justo lo que estaba buscando. Gracias!