screen-orientation

how to show a webview inside an activity in the middle of screen

◇◆丶佛笑我妖孽 提交于 2019-12-08 11:29:57
问题 I am having issue while showing a WebView in an activity in the middle of the screen. I have an activity and I want to show a webview in the center of screen. My activity is transparent so background activity will be visible. Whenever I try to create a webview and add it to activity using setContentView(webview) it always shows the view on the top left corner of the screen. Is their a way to workaround this?I am trying to do this via pure code only. Here is my code. protected void onCreate

Activity flashes up in portrait before switching to landscape

故事扮演 提交于 2019-12-08 09:34:41
问题 I am creating an android game where every activity is set to be in landscape in the xml manifest file. However, sometimes when going to a new activity it flashes up in portrait for a second before correcting to landscape. Does anyone have any generic reason why this might be? It happens when exiting the level completion screen too early which uses a ScheduledFuture Thanks Andy EDIT (Manifest): <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res

App Orientation in iOS9 Split View

无人久伴 提交于 2019-12-08 07:35:48
问题 I'm looking at how my app will run in Split View on an iPad Pro. I use constraints for layout, but sometimes I want to know the window orientation in order to tweak the layout by modifying a couple of constraints. Things are easy to handle if the user rotates the device (I handle the call of viewWillTransitionToSize), but the app has to know its initial orientation. Until now, I have been using the status bar orientation to determine the device orientation: UIInterfaceOrientation o = [

Application Crashes on orientation change while showing Progress Bar in AsyncTask

China☆狼群 提交于 2019-12-08 05:14:03
问题 I have an application which uses AsyncTask to get the json file from server and so shows the Progress Bar. But while showing the progress bar and the orientation is changed, the application crashes showing VIEW NOT ATTACHED error or HAS LEAKED WINDOW error . How to get rid of these errors? Otherwise the application works fine on AsyncTask. 回答1: Try this for your activity. Although it is not very clean. It can help <activity android:configChanges="orientation|screenSize" android:name="

Swift manually rotate view controller

柔情痞子 提交于 2019-12-08 04:23:26
So I'm working on an iOS 10 app using Swift 3 and Xcode 8.3.3. In my app I have to take successively 8 pictures with indicators on the camera. So I'm using AVCaptureVideoPreviewLayer for the custom camera and I need to set the view displaying the camera on landscape mode. I did it using this extension that I found on stackoverflow while searching for the problem. struct AppUtility { static func lockOrientation(_ orientation: UIInterfaceOrientationMask) { if let delegate = UIApplication.shared.delegate as? AppDelegate { delegate.orientationLock = orientation } } /// OPTIONAL Added method to

Android screen orientation data lose prevention

五迷三道 提交于 2019-12-08 02:49:21
问题 I am trying to stop my app from resetting whenever the user flips the screen. I don't really want to set it to portrait permanently. My problem is I have settings which erase and a service which stops each time the screen flips. I would like to keep things as they are regardless of the screen orientation. 回答1: On your Activity in your AndroidManifest, set the following: <activity android:name="YourActivity" android:configChanges="orientation|keyboardHidden"></activity> This tells your

iOS6 Orientation Still Rotating even when told not to

巧了我就是萌 提交于 2019-12-08 02:03:39
问题 I seem to be having difficulties with my iOS Application. It's deployment target is iOS5.0, however I am using the iOS 6.0 SDK. In my View Controller I have: -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationMaskPortrait; } -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return (toInterfaceOrientation ==

How to fix orientation on Windows Phone 8 Phonegap app?

我们两清 提交于 2019-12-07 17:09:02
问题 Does anybody know how to fix the orientation in Phonegap app for Windows Phone 8? I want the app only supports portrait orientation. 回答1: The accepted answer isn't right the right answer is: Open the MainPage.xaml and change this for the orientation you want, minie was Portrait SupportedOrientations="Portrait" Orientation="Portrait" 回答2: You need to create a plugin if you want to do this dynamically. First create a handler in your MainPage.xaml file: public MainPage() { ... ScreenLockCommand

ipad default-landscape not displaying

怎甘沉沦 提交于 2019-12-07 16:36:28
问题 I have added both images. Default-Portrait.png and Default-Landscape.png. But whenever I start my app, only the portrait default image is displayed irrespective of the orientation. Why is this happening? 回答1: I had the same problem and solved it by adding the following to the Info.plist file (from Xcode): <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string

Windows Phone - change layout on orientation change

99封情书 提交于 2019-12-07 15:50:30
问题 I am building a Windows Phone 8 application that uses a Pivot control to display data for a given date for different users. Each PivotItem holds a different user. Currently my application only supports Portrait orientation but I want to build in support for Landscape orientation as well. In doing so, I would like each PivotItem to no longer only show data for one date, but for a full week, hereby changing the layout significantly. My first approach was to navigate to a new page with the new