screen-orientation

How to detect my screen orientation in portrait locked screen in android?

余生颓废 提交于 2019-11-26 16:45:21
问题 I want to find the camera screen orientation in locked portrait orientation mode, well I am using camera in my fragment class and I have already set my screen orientation as portrait, but the problem I am facing is, when I turn my camera from portrait to landscape its getting changed and I need to set capture button visible only when the camera is in portrait mode. Can anyone help me to get the orientation changes in portrait mode? Below is my code: getActivity().setRequestedOrientation

Activity in portrait or reverse portrait only

僤鯓⒐⒋嵵緔 提交于 2019-11-26 16:43:08
问题 I want my activity to be available only in both portrait modes - portrait and reversePortrait. How can I achieve this? When I set android:screenOrientation="portrait" it will force activity to be only in normal portrait - vice versa with reversePortrait. Please, don't tell me it's a bad approach to force/lock orientation. I know about it, but still client is requesting it. Thanks for understanding and for any ideas. UPDATE: API Level 11 and higher 回答1: If you are on API level 9+, use android

PhoneGap - Forcing Landscape orientation

橙三吉。 提交于 2019-11-26 16:37:21
I started looking into PhoneGap yesterday and created a simple "marble" rolling around while tilting the phone. I am currently developing on Android but I want the orientation to stay as landscaping instead of moving when the phone gets spun around. Is there a way of doing this? Manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.phonegap.helloworld" android:versionCode="1" android:versionName="1.0" > <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android

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

iPhone Storyboard: different scene for portrait and landscape

…衆ロ難τιáo~ 提交于 2019-11-26 15:46:32
问题 If you scroll down a bit at this Apple Developer Page you'll find the section "Creating an Alternate Landscape Interface". The basic approach described there is to present a different NIB file as a modal view when orientation changes. I am using the Storyboard feature, so I don't have NIBs. How do I load a different "scene" in that case? Besides that, I am using a Tab Bar controller, I don't want to show a modal view. I just want to replace the current portrait view with a landscape view

shouldAutorotateToInterfaceOrientation is not working in iOS 6

若如初见. 提交于 2019-11-26 13:02:35
In iOS 6 shouldAutorotateToInterfaceOrientation is not working but it work fine in iOS 5.0 or 5.1 . What should i need to change in iOS 6 . Here is my code - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if([[[SampleApplicationAppDelegate instance].callInfoDictionary valueForKey:IS_CHAT] isEqualToString:NO_RESPONSE]) { int nAngle = 0; BOOL bRet = NO; switch (interfaceOrientation) { case UIInterfaceOrientationPortrait: nAngle = 90; bRet = YES; NSLog(@".......Preview = %f %f",_previewCamera.frame.size.width,_previewCamera.frame.size.height);

Alternative iOS layouts for portrait and landscape using just one .xib file

点点圈 提交于 2019-11-26 12:35:45
问题 Using interface builder in xcode and just one .xib file, how can I create alternate layouts when rotating between landscape and portrait orientations? See diagram of differing layouts N.b . the green view/area would contain 3 items flowing horizontal in landscape and in portrait those 3 items would flow vertically within the green view/area. 回答1: A way to do this is to have three views in your .xib file. The first one is the normal view of your Viewcontroller with no subviews. Then you create

I want my android application to be only run in portrait mode?

眉间皱痕 提交于 2019-11-26 11:46:43
问题 I want my android application to be only run in portrait mode? How can I do that? 回答1: In the manifest, set this for all your activities: <activity android:name=".YourActivity" android:configChanges="orientation" android:screenOrientation="portrait"/> Let me explain: With android:configChanges="orientation" you tell Android that you will be responsible of the changes of orientation. android:screenOrientation="portrait" you set the default orientation mode. 回答2: In Android Manifest File, put

Android: allow portrait and landscape for tablets, but force portrait on phone?

六眼飞鱼酱① 提交于 2019-11-26 09:33:22
I would like tablets to be able to display in portrait and landscape (sw600dp or greater), but phones to be restricted to portrait only. I can't find any way to conditionally choose an orientation. Any suggestions? Brian Christensen Here's a good way using resources and size qualifiers . Put this bool resource in res/values as bools.xml or whatever (file names don't matter here): <?xml version="1.0" encoding="utf-8"?> <resources> <bool name="portrait_only">true</bool> </resources> Put this one in res/values-sw600dp and res/values-xlarge: <?xml version="1.0" encoding="utf-8"?> <resources> <bool

How do I change screen orientation in the Android emulator?

泄露秘密 提交于 2019-11-26 09:15:51
问题 How do we change emulator screen orientation to landscape or portrait? 回答1: Ctrl + F12 is the keyboard shortcut. 回答2: Android Emulator Shortcuts Ctrl+F11 Switch layout orientation portrait/landscape backwards Ctrl+F12 Switch layout orientation portrait/landscape forwards 1. Main Device Keys Home Home Button F2 Left Softkey / Menu / Settings button (or Page up) Shift+f2 Right Softkey / Star button (or Page down) Esc Back Button F3 Call/ dial Button F4 Hang up / end call button F5 Search Button