screen-orientation

How to fix screen orientation to portrait for my whole PhoneGap app

我是研究僧i 提交于 2019-12-03 01:33:12
How to configure the Phonegap app to be fixed to only portrait mode, I there any possibility to do it with CSS or JavaScript so that I should be able to get the consistent behaviour across the platforms I found this useful post detecting-displays-orientation-change-on-mobile-devices-with-accelerometer-a-platform-indipendent-approach Here it is explained how to detect the orientation, but I need to configure it Is it possible through CSS3 Media queries? Maulik J To fix your orientation in portrait mode just add the below line in your activity tag in AndroidManifest.xml file: android

Android landscape right to landscape left event

筅森魡賤 提交于 2019-12-02 15:23:34
问题 I would like to now if the is any possible way to trigger an event when the layout is being redrawn because of the event of switching directly from landscape right orientation to landscape left orientation. I tried the OrientationEventListener. The problem is that it triggers to fast. I am doing UI changes and they happen before the landscape is being redrawn, and it looks bad. I could just add some delay on the changes but depending on the phone that change could last more or less. For the

How to avoid activity re-creation when being rotated, while also respecting orientation lock?

天大地大妈咪最大 提交于 2019-12-02 12:59:48
问题 Background Each time the device is being rotated, Android will destroy the current activity and re-create it with the new configuration. An easy way to avoid activity re-creation is by adding "configChanges" values to the manifest ("screenSize" and "orientation" as I recall). The problem If you use the "configChanges" attribute, the app won't respect the orientation lock feature that some (or all?) Android devices have, which prevent anything from being rotated when the screen is being

Android landscape right to landscape left event

岁酱吖の 提交于 2019-12-02 08:08:56
I would like to now if the is any possible way to trigger an event when the layout is being redrawn because of the event of switching directly from landscape right orientation to landscape left orientation. I tried the OrientationEventListener. The problem is that it triggers to fast. I am doing UI changes and they happen before the landscape is being redrawn, and it looks bad. I could just add some delay on the changes but depending on the phone that change could last more or less. For the onConfigurationChanged the timing is perfect, but of course it only works for portrait to landscape or

lock android screen orientation to landscape

百般思念 提交于 2019-12-02 06:43:56
I am developing an android application whose one feature is to lock screen orientation to Landscape , I want to apply this orientation change to all the android application in phone . I am using this code private void lockScreenOrientation() { if (!mScreenOrientationLocked) { final int orientation = getResources().getConfiguration().orientation; final int rotation = getWindowManager().getDefaultDisplay().getOrientation(); if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) { if (orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN

How to avoid activity re-creation when being rotated, while also respecting orientation lock?

北慕城南 提交于 2019-12-02 06:05:45
Background Each time the device is being rotated, Android will destroy the current activity and re-create it with the new configuration. An easy way to avoid activity re-creation is by adding " configChanges " values to the manifest ("screenSize" and "orientation" as I recall). The problem If you use the "configChanges" attribute, the app won't respect the orientation lock feature that some (or all?) Android devices have, which prevent anything from being rotated when the screen is being rotated. What I've tried I tried playing with the " screenOrientation " attribute values, yet none of them

Genymotion screen orientation issue for tablet

纵然是瞬间 提交于 2019-12-02 04:32:17
问题 I am using Genymotion. I created layout for sw800dp tablet and sw600dp. I want my app only for portrait, so what i did <activity android:name="TestCountry" android:screenOrientation="portrait" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> Now If i run the app with genymotion emulator size 1280x800 it shows following output and then press ctrl+F11 and change orientation then it

EXC_BAD_ACCESS when trying to get iPhone screen dimensions

≡放荡痞女 提交于 2019-12-02 04:05:28
问题 I'm trying to make certain elements resize according to the screen dimensions when the interface orientation changes. I've read in various places (including a few answers on here) that the way to get the bounds of the screen is to use [[UIScreen] mainScreen] bounds]. So I've added this code to see how it behaves: - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { NSLog(@"view dimensions: (%@, %@)", [[UIScreen mainScreen

Rotating Views (but not Layouts) on screen orientation change

怎甘沉沦 提交于 2019-12-02 04:00:18
问题 I would like to rotate Buttons/TextViews/etc. on screen orientation change but I want to keep layout unchanged. How can it be done? I'm using LinearLayouts. This is what I mean: 回答1: Create res->layout->layout-land and put your xml file for landscape mode Your layout file in layout folder is only for portrait mode Now if you need landscape then create layout-land folder. 回答2: It can be done it two ways: 1.) Either you define a new xml file in layout-land folder. 2.) Use android:configChanges=

Rotating Views (but not Layouts) on screen orientation change

岁酱吖の 提交于 2019-12-02 02:44:52
I would like to rotate Buttons/TextViews/etc. on screen orientation change but I want to keep layout unchanged. How can it be done? I'm using LinearLayouts. This is what I mean: Create res->layout->layout-land and put your xml file for landscape mode Your layout file in layout folder is only for portrait mode Now if you need landscape then create layout-land folder. GAMA It can be done it two ways: 1.) Either you define a new xml file in layout-land folder. 2.) Use android:configChanges="orientation" in your activity tag inside manifest.xml Then in your activity class: @Override public void