最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin5浏览0评论

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 - .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

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 - .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

Share Improve this question asked Apr 27, 2012 at 9:55 SingleWave GamesSingleWave Games 2,6489 gold badges38 silver badges53 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 14

You can use this PhoneGap Plugin for Android:

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

And add to your index.html page onload:

navigator.screenOrientation.set('portrait');

You can set the screen orientation from you code using for example setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); see http://developer.android./reference/android/app/Activity.html#setRequestedOrientation%28int%29 . In the AndroidManifest.xml you can set it only as a global option.

发布评论

评论列表(0)

  1. 暂无评论