Lock orientation in TWA

吃可爱长大的小学妹 提交于 2019-12-11 06:49:48

问题


I followed this article to make a TWA from a PWA. Everything is fine and the app feels like the PWA, but what I can't achieve is to lock the orientation to landscape.

The manifest of the PWA has this:

"orientation": "landscape", "display" : "standalone"

So if you add it to the homescreen from Google chorme it works as intended.

I tried setting the android:screenOrientation="landscape" in the manifest file and like this starts the app on landscape but it doesn't lock it.

Anyone has tried locking it?


回答1:


“Custom Tabs does not currently provide an API that allows the developer to lock the orientation.”:

https://stackoverflow.com/a/38700267/887595

You could try the “Orientation Lock” method using media queries:

https://css-tricks.com/snippets/css/orientation-lock/



来源:https://stackoverflow.com/questions/54747441/lock-orientation-in-twa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!