screen-orientation

Android | Getting screen height as width and screen width as height

扶醉桌前 提交于 2019-12-12 03:36:08
问题 I have the following piece of code in my app to get screen width and height: screenHeight = (short) Activity.getWindow().getWindowManager().getDefaultDisplay().getHeight(); screenWidth = (short) Activity.getWindow().getWindowManager().getDefaultDisplay().getWidth(); And in the AndroidManifest, I have: <activity android:name="com.test.MyActivity" android:configChanges="keyboardHidden|orientation" android:launchMode="singleTask" android:screenOrientation="landscape" android:theme="@android

fragment - EditText.setText(String) not working when string comes from savedInstanceState but works when hard coded

元气小坏坏 提交于 2019-12-12 02:49:38
问题 I have a fragment: ContactUsFragment.java import android.app.Activity; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.app.Fragment; import android.support.design.widget.TextInputLayout; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.Toast; /** * */

Continue Streaming on Orientation change

守給你的承諾、 提交于 2019-12-12 01:08:26
问题 I have a music streaming service in my activity. My problem is when orientation changes downloading process starts from beginning. I know activity recreated on orientation change. I want my activity to ignore changing orientation. I tried some methods like adding android:configChanges="orientation" or add onConfigurationChange(newConfig) to my activity but none of them works. Thanks in advanced. 回答1: try this.... android:configChanges="keyboardHidden|orientation|screenSize" > 回答2: Here you

Landscape Orientation crashing Android app

ε祈祈猫儿з 提交于 2019-12-12 00:45:31
问题 Whenever I try to change the the orientation to landscape in the app I'm developing it crashes. for portrait mode res/layout/activity_main.xml for landscape mode res/layout-land/activity_main.xml I am using Linear-Layout but eclipse keeping showing "This LinearLayout layout or its LinearLayout parent is useless" . Below is the code of Landscape Mode. Please Help. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout

Android screen orientation intent

不打扰是莪最后的温柔 提交于 2019-12-12 00:26:07
问题 My Android app is configured to work on landscape mode only, so I want to make e-mail client, which is created by intent from my app, be landscape too. Is it possible? Here is my code: Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/xml"); i.putExtra(Intent.EXTRA_EMAIL, new String[]{"example@mail.com"}); i.putExtra(Intent.EXTRA_SUBJECT, "Feedback"); i.putExtra(Intent.EXTRA_TEXT, ""); try { Intent chooser_intent = Intent.createChooser(i, "Send e-mail"); startActivity(chooser_intent)

How to detect face by portrait mode?

吃可爱长大的小学妹 提交于 2019-12-11 19:32:50
问题 I'm studying OpenCV recently. OpenCV for Android sample code(2.4.6) is tested. I have some wonder. I can detect face by sample code(OpenCV Sample - face-detection). but, can't detect face by portrait mode(vertical mode) on android device. First, I try set Front-Camera by portrait mode. //added code in onCameraFrame() method. Core.flip(mRgba, mRgba, 1); Still do not recognize face. How to detect face by portrait mode? Thank you. 回答1: you need to do transpose and then flip: int height = mGray

Change orientation of Windows 8.1 Desktop from C# wpf

淺唱寂寞╮ 提交于 2019-12-11 18:21:28
问题 Is it possible to change the orientation of the Windows 8.1 or Windows 7 desktops through C# program.. like from landscape to portrait if i select it from my application.? I know we can get the information of width and height of the screens from Screen class in System.Windows.Forms namespace. But, Is there any API which i can call to change the orientation. 回答1: There is one solution provided in MSDN I have used the same piece of code for WPF. Below is the code View.xaml <Window x:Class=

Change interface orientation when back button is pressed

隐身守侯 提交于 2019-12-11 18:03:57
问题 My app accepts only portrait orientation, except for MPMoviePlayerController , which I want to allow user to change orientation. So, I subclassed UINavigationController and added the following code: -(BOOL)shouldAutorotate { if ([[[self.viewControllers lastObject] presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]]) { return YES; } else { return NO; } } It works great, allowing only my MPMoviePlayerViewController to change orientation. The problem is that when user is

Handling orientation changes android

青春壹個敷衍的年華 提交于 2019-12-11 16:16:00
问题 I have a Table containing a number of images per row. The number of images per row is decided on the fly based on the image width and screen width. When I use the phone normally, images are spaced on the phone screen. When the phone orientation changes, all the images appear on the same row. Should I explicitly handle the orientation changes for this case? // get the number of images per column based on the screen // resolution Display display = getWindowManager().getDefaultDisplay(); int

set interface orientation on iPhone private API

南楼画角 提交于 2019-12-11 12:51:35
问题 Can anyone confirm that [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait]; will get your app rejected by Apple. Is there a good replacement available? 回答1: [[UIDevice currentDevice] setOrientation:UIInterfaceOrientation] is a private API, you can find that is signature is only in read-only (see here). If you want set the device orientation to Portrait or other mode you should override the shouldAutorotateToInterfaceOrientation: -(BOOL)shouldAutorotateToInterfaceOrientation