screen-rotation

Building project with Xcode 6 (iOS 8 SDK) causes landscape rotation rendering issue on iPad

♀尐吖头ヾ 提交于 2019-12-02 11:52:21
We have a project that behaves as desired when built using Xcode 5.1.1 (iOS sdk 7.2), but when build using Xcode 6.2 (iOS sdk 8.2) there is a rotation rendering issue on the iPad. On the iPad our app only supports landscape left and landscape right. When you rotate from one to the other, on the rotation animation the screen rotates from upside down to right side up, but when it does this it lands in the wrong position. (The bottom-left corner of the screen ends up approximately 200 pixels up from the bottom and an equal number of pixels inset from the left.) This may also happen on iPhone, but

Android: Save variables and settings on rotation

喜夏-厌秋 提交于 2019-12-02 10:32:59
Is there a way to save variables that are being changed in the code, when the screen rotates? Thank you in advance You can save values into the instanceState Bundle when stopping an activity and restoring it when you start it. Like this: @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); // Read values from the "savedInstanceState" } @Override protected void onSaveInstanceState(Bundle outState) { // Save the values you need into "outState" super.onSaveInstanceState(outState); } Riot Goes Woof Expanding on GSala's

Can I transition between view controllers without a rotation animation?

為{幸葍}努か 提交于 2019-12-01 14:28:43
I have two controllers: MainController, which supports only portrait PhotoController, which supports all orientations. These are contained in a navigation controller. This scenario doesn't work well: The device is physically in landscape mode, with MainController on screen, so the UI is in portrait mode. We push PhotoController on the navigation stack. The UI rotates with a rotation animation. Technically, it works as intended. But the rotation animation is jarring in terms of UX. I want the transition between view controllers to happen without an animation. I want the system to pretend that

Android - don't refresh Google Maps v2 on rotation

最后都变了- 提交于 2019-12-01 01:41:54
问题 When I rotate my device, Google Maps v2 refreshes. How do I prevent this refresh from occurring? I'm adding the map dynamically in a tab of a SherlockFragment. 回答1: I fixed the problem by adding to the Activity in AndroidManifest.xml: android:configChanges="orientation|screenSize" Edit (04/28/2017) : From the Android Documentation: Note: Using this attribute should be avoided and used only as a last resort. Please read Handling Runtime Changes for more information about how to properly handle

How to restore textview scrolling position after screen rotation?

时间秒杀一切 提交于 2019-11-30 23:47:29
In my Android Layout, I have a TextView. This TextView is displaying a rather large spannable text and it is able to scroll. Now when the phone is rotated, the View is destroyed and created and I have to setText() the TextView again, resetting the scroll position to the beginning. I know I can use getScrolly() and scrollTo() to scroll to pixel positions, but due to the change in View widths, lines become longer and a line that was at pixel pos 400 might now be at 250. So this is not very helpful. I need a way to find the first visible line in a TextView in onDestroy() and then a way to make

android numberpicker index outofbounds rotation

爷,独闯天下 提交于 2019-11-30 23:07:58
I am trying to create a custom time picker. But the problem that ran into is that when i rotate the screen. also if I press the home button to leave the app it crashes when i come back with the same error. public class MyTimePicker extends RelativeLayout { private NumberPicker hour; private NumberPicker minute; private NumberPicker am; private int interval = 5; public MyTimePicker(Context context) { super(context); init();} public MyTimePicker(Context context, AttributeSet attrs) { super(context, attrs); init();} public MyTimePicker(Context context, AttributeSet attrs, int defStyleAttr) {

Change color behind app on rotation

余生长醉 提交于 2019-11-30 22:08:47
When an iOS app rotates it will reveal a black background when the app is between portrait and landscape. Is it possible to change this color from the default black to white? Changing the UIWindow's background color will not help. Here is an example of the black background in Safari during rotation: I have done something similar but I couldn't find the source now, but here is the idea: Create and add a significantly larger view as backing view and center it. Add the UIWebView as subview of this large view whose background is white. Re-position the center of the UIWebView , too. You can do this

android numberpicker index outofbounds rotation

我只是一个虾纸丫 提交于 2019-11-30 18:14:22
问题 I am trying to create a custom time picker. But the problem that ran into is that when i rotate the screen. also if I press the home button to leave the app it crashes when i come back with the same error. public class MyTimePicker extends RelativeLayout { private NumberPicker hour; private NumberPicker minute; private NumberPicker am; private int interval = 5; public MyTimePicker(Context context) { super(context); init();} public MyTimePicker(Context context, AttributeSet attrs) { super

Change color behind app on rotation

北战南征 提交于 2019-11-30 17:56:38
问题 When an iOS app rotates it will reveal a black background when the app is between portrait and landscape. Is it possible to change this color from the default black to white? Changing the UIWindow's background color will not help. Here is an example of the black background in Safari during rotation: 回答1: I have done something similar but I couldn't find the source now, but here is the idea: Create and add a significantly larger view as backing view and center it. Add the UIWebView as subview

Using onConfigurationChanged in a fragment

蓝咒 提交于 2019-11-30 11:47:08
I have this code in a fragment public class TestOne extends Fragment { View view = null; @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); LayoutInflater inflater2 = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater2.inflate(R.layout.testone, null); Toast.makeText(getActivity(), "Rotate fragment", Toast.LENGTH_SHORT).show(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Toast.makeText(getActivity(), "onCreate Fragment", Toast.LENGTH