问题
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