screen-orientation

realize “back arrow” with help basefragment

拟墨画扇 提交于 2019-12-13 06:39:42
问题 I have BaseFragment public abstract class BaseFragment extends Fragment { private static String TAG = "BaseFragment"; private BaseFragmentActions baseFragmentActions; @Override public void onAttach(Context context) { super.onAttach(context); Log.i(TAG, "onAttach = "); try { baseFragmentActions = (BaseFragmentActions)(StartPageActivity)getActivity(); } catch (ClassCastException e) { throw new ClassCastException(((StartPageActivity)getActivity()).toString() + " must implement interface

Different widgets (views) for different screen orientations?

半城伤御伤魂 提交于 2019-12-13 04:32:54
问题 I'm quite new developing for Android so I have a very basic question. Basically, I have two screen layouts, one for portrait and another for landscape orientation. I use the folders res/layout and res/layout-land. Both orientations are drawn fine, but I have different widgets (buttons) for each orientation, btnPortrait and btnLandscape. The problem arises when I try to call onSetClickListener(). Because when the device is oriented in portrait the framework can't locate the btnLandscape and

Set Orientation to Portrait on iPhone

爱⌒轻易说出口 提交于 2019-12-13 02:21:34
问题 I have an application that consists of a login, 3 tables, and then an image. You can rotate the image to landscape mode but what I want to be able to do is when the 'back' button is pushed and the app returns to the previous screen, I was the app to automatically rotate to give a portrait view. Is there any way of doing this? 回答1: If the previous view controller only supports portrait (see shouldAutorotateToInterfaceOrientation: ) then it should automatically rotate. If the previous view

Device: force orientation landscape (Phonegap JQueryMobile)

人走茶凉 提交于 2019-12-12 13:33:50
问题 I have been searching for days for a way to always display just one particular jquery mobile page div in landscape mode. Anyone any examples or ideas that could help, I would really appreciate it. function forceLandscape() { console.log('Starting: forceLandscape '); console.log('----------------------------------------------------'); // var orientation = window.orientation; // var new_orientation = 0; // switch (orientation) { // case 90: // break; // case -90: // new_orientation = 180 // $(

Prevent Live Wallpaper from changing screen orientation

為{幸葍}努か 提交于 2019-12-12 12:05:42
问题 I'm working on a Live Wallpaper and I would like to keep it always in portrait mode. I know it's possible for an Activity to declare the orientation in the Manifest, but I can't find a way to do the same with a live wallpaper service. Is it possible somehow to tell the Wallpaper Engine to swap the x and y axis in the rendering process or something similar, because I have no idea anymore. 回答1: Use the following method to check for orientation changes public void onSurfaceChanged(SurfaceHolder

Android - Handle Screen Orientation

元气小坏坏 提交于 2019-12-12 10:08:06
问题 I'm currently working on an Android application that have different behaviors according to the screen orientation. I'm using getWindowManager().getDefaultDisplay().getRotation() to get the screen orientation in the onCreate() method and manage from there. Basically, my problem is that I need a control over the orientation. In landscape mode, when the user decides it, the application must switch to portrait mode, and stays like that, but only until the use goes to portrait mode, and then again

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

一个人想着一个人 提交于 2019-12-12 08:18:27
问题 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

how to change layout on orientation change for titanium ipad

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 05:47:39
问题 I'm trying to make a spec on the ipad for an image gallery that has a 3x3 portrait layout but changes to a 3x2 layout on landscape. I'm trying to get the landscape or portrait grid on application load and then change also on orientation change but every time I do change my orientation the thumbnails flicker and the grid is all out of wack. http://pastebin.com/sLppSpS9 I'm thinking 'clear out or reset' the view, is there way to do that? 回答1: I've done similar with Windows, rather than views -

Fix orientation of screen on Dialog view

淺唱寂寞╮ 提交于 2019-12-12 04:21:12
问题 I am using a custom dialog in my activity. I want to set the screen orientation only if the dialog is shown elsewhere the screen orientation can change to portrait to landscape vice versa. Is there any way to fix the orientation for such particular case specifically in java code. 回答1: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //Show dialog here //... //Hide dialog here setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); 回答2: We had to do this in a

Adding UIViewController messes up screen orientation

╄→гoц情女王★ 提交于 2019-12-12 03:43:01
问题 I started with a GLSprite sample app (source code), then added a UIViewController by adding UIViewController *vc = [[UIViewController alloc] init]; vc.view = glView; self.window.rootViewController = vc; [window makeKeyAndVisible]; to the end of GLSpriteAppDelegate::applicationDidFinishLaunching. The controller seems to be working as now I can pop up gamecenter windows, but it has messed up my screen orientation . The app is fine in portrait , but in all other rotations it incorrectly has