screen-orientation

iOS 8 - UIWindow Orientation Is Always Portrait

天大地大妈咪最大 提交于 2019-12-04 05:24:52
问题 I am updating an iOS 6 app to iOS 8 (iPad), and any new UIWindows that I create are always showing up in Portrait mode. The app originally supported both the Portrait and Landscape orientations but now will only support Landscape. I've changed the supported orientations in the project file to Landscape Left and Landscape Right. The entire UI shows up in landscape, as expected, but when I create a new UIWindow , it shows up in portrait. The new UIWindow 's frame matches the screen's frame

lock android screen orientation to landscape

不打扰是莪最后的温柔 提交于 2019-12-04 05:13:04
问题 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)

Wrong View Height/Width value on Orientation change?

点点圈 提交于 2019-12-04 04:25:51
I implemented onConfigurationChnage(..) to read value of view height and width on orientation configuration chnage @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int height = displaymetrics.heightPixels; int width = displaymetrics.widthPixels; Log.i(TAG, "onConfigurationChanged: "+newConfig.orientation+", "+height+", "+width + ", "+mTempeFrameLayout.getWidth()); } but it always reply old value, if orientation

Disable and enable orientation changes in an activity in Android programatically

a 夏天 提交于 2019-12-04 03:35:09
I have an App that make some background staff. When the background work is running a progress Circle is shown, if the device is rotated during this time then the Activity is "reset" and I want to avoid that. For this reason I decided disable orientation during this process. I have seen differends threads for this question but none with a valid solution, at least in my case. The solutions posted are about fixing the activity orientation but you have to deal with the fact that the REVERSE orientations are not returned if you use: getResources().getConfiguration().orientation The function above

Prevent Live Wallpaper orientation change when an application is opened and orientation is changed?

情到浓时终转凉″ 提交于 2019-12-04 02:53:07
I'm having an orientation issue with a Live Wallpaper that I wrote. Basically the canvas will rotate depending on the application opened above it. I tested this and realized that the onSurfaceChanged() method is firing when I return to the home screen from a previously opened application who's orientation was changed. I suppose a better question would be, why does my Live Wallpaper Surface Change when an application is opened and it's orientation changed? Is there a way to prevent my Live Wallpaper orientation from ever changing? Thanks, hope that makes sense? You can handle screen orientation

How to set orientation in two different mode , in two layout?

我只是一个虾纸丫 提交于 2019-12-03 23:05:44
问题 I have layout that is called Main.XML and I set the orientation to portrait in my AndroidManifest.xml . I designed this layout for Honeycomb too and placed it in the layout-xlarge-mdpi folder, but I want to use the Main.XML in layout-xlarge-mdpi only in landscape orientation. Now, how can do this? Thanks 回答1: You can place your main.xml in layout-xlarge-land , then it will be used only in landscape orientation Refer Supporting Multiple Screens (Using configuration qualifiers) Android supports

How do you force a configuration change in an Android Robolectric test?

蓝咒 提交于 2019-12-03 22:29:08
I'm using robolectric to make my android unit tests fast enough to be useful. I want to test that code I've written works while the screen orientation is changing to simulate a common real world use case. Specifically what I'm testing is an asynchronous http call to a server with some xml parsed after the result is fetched. I have the unit test for all that working great but can't figure out how to simulate the screen rotation. Any state change that causes the activity to recreate itself is fine, it doesn't necessarily have to be screen rotation. A solution that uses the emulator is not an

Lock screen Orientation to portrait - ios swift

微笑、不失礼 提交于 2019-12-03 17:41:32
问题 I am creating an application with support only for portrait mode. I don't want Landscape or Portrait upside down. I tried some code. Which allows me to lock in portrait mode. I am using navigationcontroller and presentviewcontroller. Now my problem is: 1. If I rotate my device upside down and open my application it opens in upside down mode which is wrong. 2. I click some button and enter to presentviewcontroller it returns to portrait mode. I want all the navigationcontroller and

How I can get screen orientation?

 ̄綄美尐妖づ 提交于 2019-12-03 17:31:42
I'm entering number of screen on which I want to show the form. And I must get screen orientation. Does anybody know how to do that? public UIManager(int screenIndex) { this.ScreenIndex = screenIndex; try { Screen[] all_screens; all_screens = Screen.AllScreens; if (all_screens.Length >= ScreenIndex) { this.customer_form.Left = all_screens[this.ScreenIndex].Bounds.Width; this.customer_form.Top = all_screens[this.ScreenIndex].Bounds.Height; this.customer_form.Show(); } } catch { //Do nothing } } You can use the value from the Windows.Graphics.Display.DisplayInformation class , returned by

App size is too big because of too many images

落爺英雄遲暮 提交于 2019-12-03 17:00:03
I'm creating an universal app. For one screen, I'm displaying 6 images (png format) in a grid using this control. Also this screen supports both portrait and landscape orientation. I've created a set of images in different resolutions for all the iDevices and named them using the correct naming convention as follows. name~iphone.png name@2x~iphone.png name~ipad.png name@2x~ipad.png name-568h@2x~iphone.png (iPhone 5) And I had to create another set of these images since I support both orientation and I can't use the same images as above because in landscape it would stretch. Now I have close to