orientation-changes

iOS 7: Keeping the displayed items in the viewing area after rotation of UICollectionView

血红的双手。 提交于 2019-12-20 04:37:31
问题 I'm using a UICollectionView with horizontal scrolling (Layout = UICollectionViewFlowLayout ). After rotation I adapt the content offset so that the same items are displayed before the rotation. On rotation the width of the items are changed, because there are always seven items on screen. My current approach does work for iOS 8, but not for iOS 7. On iOS 7 layoutAttributesForItemAtIndexPath always returns the same X position regardless of the orientation. So it seems that some frame is not

Javascript doOnOrientationChange :can't fix a bug loading the page

独自空忆成欢 提交于 2019-12-20 04:25:53
问题 I used a .js to avoid landscape view from mobile device. I edited a white full-screen image saying "this site is not thought to be viewed in landscape mode, please turn your device" to be shown each time I rotate my device from portrait to landscape. It works except when I load a page and I'm already in landscape mode. Any idea on how to fix it? Thanks <script> (function() { 'use strict'; var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry:

Android PhotoView Keep Zoom After Orientation Change

核能气质少年 提交于 2019-12-18 03:39:15
问题 I am utilizing the PhotoView class by Chris Banes to be able to zoom into an image and see it, but I want to make it so that when I change the orientation, the photo will still be zoomed in after the change. I understand the basics of how to do this, that when an orientation change is detected, onSaveInstanceState will be called, so I'm trying to save the instance in there, and then put it back into the PhotoView when onCreate is called. public class MainActivity extends ActionBarActivity {

How to stop changing the orientation when a progress bar is spinning in android

拟墨画扇 提交于 2019-12-17 12:42:56
问题 I have a Registration screen where user enters all the registration details and when user clicks on the "Register" button i am showing the progress bar(Progress bar begins to spin) and then takes the user to the home screen.If the user rotates the phone when progress bar is spinning, the progress bar gets dismissed.I want the orientation not to change from potrait to landscape and vice versa,when a progress bar is visible(meaning it is spinning).How to stop the orientation change when

Mobile viewport height after orientation change

若如初见. 提交于 2019-12-17 11:44:21
问题 I am attaching a listener to the orientationchange event: window.addEventListener('orientationchange', function () { console.log(window.innerHeight); }); I need to get the height of the document after the orientationchange . However, the event is triggered before the rotation is complete. Therefore, the recorded height reflects the state before the actual orientation change. How do I register an event that would allow me to capture element dimensions after the orientation change has been

Mobile viewport height after orientation change

我是研究僧i 提交于 2019-12-17 11:43:31
问题 I am attaching a listener to the orientationchange event: window.addEventListener('orientationchange', function () { console.log(window.innerHeight); }); I need to get the height of the document after the orientationchange . However, the event is triggered before the rotation is complete. Therefore, the recorded height reflects the state before the actual orientation change. How do I register an event that would allow me to capture element dimensions after the orientation change has been

How to disable specific orientation in iOS

谁说我不能喝 提交于 2019-12-12 15:57:20
问题 I want to disable landscape orientation in some view. I have overridden the following two methods but these method is not going to call at any time. - (NSUInteger) supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } - (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationPortrait; } Am I missing something? Please help me. 回答1: Create subclass of UINavigationController and override these methods as per below: -

Duplicate ListFragment entries when changing orientation

给你一囗甜甜゛ 提交于 2019-12-11 18:10:07
问题 So, I'm developing an app with fragments, and everything is fine, except that when I change orientation the entries on my ListFragment duplicate like this: And when I go back to portrait mode, the items are still duplicated; until I kill the process and restart. To populate the list I'm using an AsyncTaskLoader , but it only runs once, when the application starts for the first time; then my adapter gets filled with the info for the rows. I'm not using the <fragment> tag in my main.xml, the

An Android orientation glitch?

北战南征 提交于 2019-12-11 13:50:40
问题 I believe to have stumbled upon an inherent glitch in the orientation handling of Android. I have an activity A setContentView(R.layout.activity_main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); No sensor implies that the Activity A won't be affected by the physical device rotation. I also have an activity B which has an overridden onSaveInstanceBundle /*Will be called before orientation change*/ @Override protected void onSaveInstanceState(Bundle currentState) { super

Android: Setting List Adapter for a ListFragment after Orientation Change Results in an Empty List

廉价感情. 提交于 2019-12-11 05:17:06
问题 I am trying to handle orientation changes on my Android app. I have faced a problem while trying to set adapter for my ListFragment after orientation has changed. There are no exceptions but the list remains empty; it's not filled with the given data. I am aware that on orientation change the whole activity is recreated. I also implemented a way to pass data from the old orientation to the new one. I have checked that just before calling ListFragment.setAdapter() the ArrayList of data is not