I have an Android app which consists mainly of a WebView that wraps a website.
If I lock the orientation of my phone into portrait mode lets say, when I open the app, the website within the WebView doesn't respect the locked portrait orientation. Instead if I hold the phone vertically, the website display in portrait mode as expect... BUT as I turn the phone horizontally, instead of staying in portrait mode, the website switches to landscape mode.
How can I fix this? I imagine that the WebView screen size is updating as the phone is rotating from vertical to horizontal, and so the website reorients itself... despite the over android phone being locked in portrait mode. Why does the WebView still tell the website the screensize has changed? How do I prevent this?
Related
I want to show my website landscape when phone is landscape. is it possible ? im using bootstrp and when u brosw it on safari it automatically landscape when the orientation is landscape but on my app which gets what on the website it only allow portrait can you please help me force landscape the website when its landscape
Let say I have an application designed to open other applications just like a apps screen on android phones. I wanted to keep the device in landscape. At the same time, if other applications designed to be working in a portrait mode, I wanted to show as Portrait in a landscape screen rather than stretch the application to fit within the landscape screen.
This is the screenshot as an example:
The red shape is the application running in portrait.
The black shape is the screen of the device in landscape.
At the moment, my application will load the portrait app in full screen mode which the red shape will be fill the whole screen.
P.S. The device I am using can be rooted.
My launcher at the moment can load the application and cause the application to rotate into portrait on a Portrait screen.
Spending days of finding. The solution is to root the device and calling wm size 300x800 or any number as a su privilege in code.
The way to root the emulator to test can be found in here:
https://android.stackexchange.com/questions/148841/attempt-to-root-avd-running-android-4-4-5-1-is-failing
Use the appropriate API Level as stated in the answer. Otherwise it may not work.
The way to call the su command :
https://github.com/neoimale/android-screen-mock/blob/master/ScreenMock/src/com/dianping/screenmock/MainActivity.java
I made a game with Adobe AIR and ActionScript 3 for Android devices.
My problem is with landscape mode. Everything is fine as long as the device get lock screen.
When you open the screen and return to the game, it has changed from landscape to portrait mode.
I fixed this with:
stage.addEventListener(Event.ACTIVATE,Activate);
into Activate function: stage.setAspectRatio(StageAspectRatio.LANDSCAPE);
into Activate function: stage.displayState = StageDisplayState.FULL_SCREEN;
portrait problem is fixed but FULL SCREEN is with android titlebar... How can I fix it?
My app runs in landscape mode.
I have android:screenOrientation="landscape" set in AndroidManifest.xml file.
If the screen orientation of the device is locked to portrait mode, then my app still runs in landscape mode. But the gallery activity started from within the app runs in portrait mode.
Is there any way to force gallery activity to always run in landscape mode?
As long as the device is locked to portrait mode, There is no way to achieve this.
Of course you could try to change the device orientation to landscape (in your app) so that the gallery runs in landscape but this will cause a confusion to the user.
I want the home screen and the lock screen to be in the landscape mode. I used this app and able to make the home screen to stay in landscape mode but the lock screen is still in the portrait mode. I would like to know how this app changing the orientation of the home screen and is it possible to change the orientation of lock screen to landscape without installing some other third party lock screen.
I am only looking for the solution that works on Nexus 7.
Google has released a new version for Nexus 7 Android 4.1.2 which supports both home screen and the lock screen in the landscape orientation. Please update your software..