Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
170 views
in Technique[技术] by (71.8m points)

java - Android - Fix screen orientation for 1 page only (phonegap)

I am having an issue with fixing the screen orientation for my index.html page only. I want to allow the app to rotate except on the home page. I understand that adding the following into you activity - android:screenOrientation="portrait" stops the screen from rotating.

However, I need to set this so it is page specific. I am using phonegap and therefore, need to stop my web view pages.

I tried calling the following activity within my manifest - com.phonegap.droidgap.index.html, however this did not work.

Could someone please advice me as to how I can define the fixed orientation for 1 page only?

Thanks in advance

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use this PhoneGap Plugin for Android:

https://github.com/champierre/pg-plugin-screen-orientation

And add to your index.html page onload:

navigator.screenOrientation.set('portrait');

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...