I can already lock the android application in landscape mode from the manifest file of android. But we use a custom tablet built solely for our company and due to the manufacturing defect, the laptop orientation is reversed.
Is there any way I can lock the application in reverse landscape mode??
You can use react-native-orientation-locker which allows us to lock the orientation of device in our desired way using the following methods,
lockToPortrait()
lockToLandscape()
lockToLandscapeLeft() this will lock to camera left home button right
lockToLandscapeRight() this will lock to camera right home button left
Related
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'm developing an Android Application which is locked to portrait mode for phones. In one part of the application, the user can look at some nice Graphs. In this part (only), it would be nice to allow the user to change to landscape mode - if he wants to.
I know this would be quite simple if the Graphs were contained in their own activity, but unfortunately, they are not. They are shown by Fragments which in turn are shown in a somewhat complex Tab Layout.
In other words; I want to have to whole app locked to portrait mode except when the user is in a specific Fragment. Then I want to allow him to allow him to change to landscape mode (Not neccessarily by rotating the device, other solutions are welcome too). When the user navigates away from that part of the app from Landscape mode, the portrait mode should be restored.
Is there any way this can be achieved?
you can do it dynamically this way :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
I have a project requirement to create a kiosk based application which will always be in the landscape mode,for which I am making use of a tablet running on 4.2.2.One of the modules has the functionality to make phone calls.For making the calls from my app, I invoke the default android dialer app.However,I notice that even if my device is physically in the landscape mode,at times when the default dialer app is called,it first displays its portrait layout and the quickly switches to the landscape one(which is not visually appealing).Now,since I do not have access to modify the source code of the default dialer app,I was wondering if there is a way that I can specify a system level screen orientation as landscape ?
PS: I have root access for my tablet.
Any help would be appreciated.Many thanks !
There's an app for that: Rotation Locker
You can also add the switch ro.sf.hwrotation 90 in your build.prop file
I'm working on an application that will appear on the home screen that I've been testing on my phone in debug mode. However, none of the five phones I have will switch the home screen into portrait mode, making it impossible to test my app in portrait mode. I know that ctrl+F11 will rotate the emulator between portrait and landscape modes. However, much like my physical phones the emulator, when rotated to landscape, simply displays everything sidewise at a 90 degree angle.
Is there a way that the emulator can be setup to allow a landscape home screen? If not, how does one test an application that requires that short of buying one of the few phones that support it?
you can press Numpad 7 to rotate the emulator
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..