orientation-changes

How to set page orientation for Word document?

陌路散爱 提交于 2019-11-29 07:20:59
I use Apache POI XWPF to create and handle MS Word documents. But I didn't find in the documentation how to change the page orientation. Apparently this way should make it: XWPFDocument doc = new XWPFDocument(); CTDocument1 document = doc.getDocument(); CTBody body = document.getBody(); if (!body.isSetSectPr()) { body.addNewSectPr(); } CTSectPr section = body.getSectPr(); if(!section.isSetPgSz()) { section.addNewPgSz(); } CTPageSz pageSize = section.getPgSz(); pageSize.setOrient(STPageOrientation.LANDSCAPE); But this method doesn't work properly. I can set the page orientation to landscape,

Assigning Fragments to tabs in the ActionBar with different orientations

孤者浪人 提交于 2019-11-28 17:11:13
问题 I have 3 fragments and an activity. I want to enable tabs on the ActionBar and assign a Fragment to each of the 3 tabs. How do I hook that up correctly? ORIGINAL POST I have an app that I'm developing using the Google I/O app as a guide. I've implemented tabs into the ActionBar . They seem to be working until the tablet's orientation changes. For example, all 3 tabs have a Fragment . I can switch between them just fine, but when I change the orientation, whatever the Fragment I was last

How to set page orientation for Word document?

断了今生、忘了曾经 提交于 2019-11-28 00:57:36
问题 I use Apache POI XWPF to create and handle MS Word documents. But I didn't find in the documentation how to change the page orientation. Apparently this way should make it: XWPFDocument doc = new XWPFDocument(); CTDocument1 document = doc.getDocument(); CTBody body = document.getBody(); if (!body.isSetSectPr()) { body.addNewSectPr(); } CTSectPr section = body.getSectPr(); if(!section.isSetPgSz()) { section.addNewPgSz(); } CTPageSz pageSize = section.getPgSz(); pageSize.setOrient

How to detect when the device switch from portrait to landscape mode? [duplicate]

空扰寡人 提交于 2019-11-27 21:41:09
This question already has an answer here: How to detect orientation change in layout in Android? 9 answers I have an app which shows fullscreen bitmaps in an activity. In order to provide fast loading time, I load them in the memory. But when the screen changes orientation, I would like to clear the cache in order to fill it again with bitmaps that fit inside the new dimensions. The only problem is that in order to do this, I need to detect when an orientation change occurs. Do anyone know how to detect this? See the official documentation http://developer.android.com/guide/topics/resources

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

 ̄綄美尐妖づ 提交于 2019-11-27 15:03:42
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 progress bar is spinning?Any help would be appreciated. This is happening because when screen orientation

Get phone orientation but fix screen orientation to portrait

帅比萌擦擦* 提交于 2019-11-27 12:41:57
I want to get the phone orientation but keep the screen orientation to portrait. So no matter the user turns the phone to landscape or portrait, the view stays the same, but I can get whether it is turned to landscape or portrait. Setting the activity to android:screenOrientation="portrait" will fix both but I wouldn't be able to detect the phone orientation via public void onConfigurationChanged(Configuration newConfig) { switch (newConfig.orientation) { case Configuration.ORIENTATION_PORTRAIT: Toast.makeText(this, "Portrait", Toast.LENGTH_SHORT).show(); break; case Configuration.ORIENTATION

How to detect when the device switch from portrait to landscape mode? [duplicate]

拜拜、爱过 提交于 2019-11-26 20:46:39
问题 This question already has an answer here: How to detect orientation change in layout in Android? 9 answers I have an app which shows fullscreen bitmaps in an activity. In order to provide fast loading time, I load them in the memory. But when the screen changes orientation, I would like to clear the cache in order to fill it again with bitmaps that fit inside the new dimensions. The only problem is that in order to do this, I need to detect when an orientation change occurs. Do anyone know

Detecting if a device is able to change orientation in JavaScript

怎甘沉沦 提交于 2019-11-26 16:38:08
问题 Is there a native JavaScript (or through the use of a library such as JQuery/Modernizr etc) way to detect if a device is capable of changing orientation? I would like to use that as a method to differentiate between desktop and mobile. Thanks, Shadi 回答1: Detecting mobile devices: Simple browser sniffing if (/mobile/i.test(navigator.userAgent)) {...} jQuery.browser.mobile plug-in (exhaustive browser sniffing) Simple test for touch events if ('ontouchstart' in window) {...} Advanced test for

Get phone orientation but fix screen orientation to portrait

若如初见. 提交于 2019-11-26 16:06:31
问题 I want to get the phone orientation but keep the screen orientation to portrait. So no matter the user turns the phone to landscape or portrait, the view stays the same, but I can get whether it is turned to landscape or portrait. Setting the activity to android:screenOrientation="portrait" will fix both but I wouldn't be able to detect the phone orientation via public void onConfigurationChanged(Configuration newConfig) { switch (newConfig.orientation) { case Configuration.ORIENTATION

How to detect orientation change?

别说谁变了你拦得住时间么 提交于 2019-11-26 10:09:49
I am using Swift and I want to be able to load a UIViewController when I rotate to landscape, can anyone point me in the right direction? I Can't find anything online and a little bit confused by the documentation. David Here's how I got it working: In AppDelegate.swift inside the didFinishLaunchingWithOptions function I put: NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.rotated), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil) and then inside the AppDelegate class I put the following function: func rotated() { if