screen-orientation

Detecting device orientation change using android:screenOrientation

99封情书 提交于 2019-12-06 10:51:13
Is there a way to detect device orientation events or at least to get the current device orientation while using android:screenOrientation in the manifest ? I mean device orientation not application orientation. My problem is I really want to keep my application in portait mode (it's a web view) but I want to handle orientation change myself in my app. When android:screenOrientation is setted, orientation getted by methods is always the application orientation, not the device orientation. Regards, Gaëtan Yo can use the acelerometer to detect the device orientation. I know, it's more hard but I

Android splash screen for both landscape and portrait orientation

自作多情 提交于 2019-12-06 09:45:16
问题 How can I modify my this code to set splash screens for both landscape and portrait orientation. I managed to work on portrait mode and it is working fine. i like ti make it for both the orientation. please modify this code. This is my SplashActivity.java. public class SplashActivity extends Activity { // Splash screen timer private static int SPLASH_TIME_OUT = 3000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout

Android screen orientation data lose prevention

微笑、不失礼 提交于 2019-12-06 06:30:43
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. On your Activity in your AndroidManifest, set the following: <activity android:name="YourActivity" android:configChanges="orientation|keyboardHidden"></activity> This tells your Activity to not "re-create" itself on screen orientation changes or keyboard change state You can save the data by

How to restrict j2me application in the Landscape mode only

依然范特西╮ 提交于 2019-12-06 06:17:48
问题 I am developing application using J2ME and LWUIT.I want to run this application on landscape mode only. For Nokia there is an attribute : Nokia-MIDlet-App-Orientation: landscape but for other device , What is the attribute to restrict the application to landscape mode only? How to achieve this for different J2ME devices? 回答1: Following is the attribute to restrict application in landscape mode only. Nokia device: Nokia-MIDlet-App-Orientation : Landscape Samsung device: MIDlet-ScreenMode :

Android - Handle Screen Orientation

[亡魂溺海] 提交于 2019-12-06 06:17:17
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 to landscape. I'm using setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) to change

Force Landscape mode in single page in Xamarin iOS?

烂漫一生 提交于 2019-12-06 06:05:54
I use a dependency service to force landscape for a single page in Android and iOS, this is for Android: public class OrientationService : IOrientationService { public void Landscape() { ((Activity)Forms.Context).RequestedOrientation = ScreenOrientation.Landscape; } public void Portrait() { ((Activity)Forms.Context).RequestedOrientation = ScreenOrientation.Portrait; } } it works well and as required: forcing the landscape mode, even the the device orientation in hand is portrait, I need to achieve the same for iOS, tried this (tried also the commented code): public class OrientationService :

sensorPortait typo

旧街凉风 提交于 2019-12-06 02:04:55
问题 http://developer.android.com/reference/android/R.attr.html#screenOrientation is sensorPortait a typo mistake? I see threads around guiding people to use sensorPortrait but my eclipse works with sensorPortait instead. 回答1: It doesn't matter - its consistent, also for reversePortait, and as you said, eclipse doesn't let you use sensorPortrait. But my guess is that someone in Google is copy-pasting too much... 来源: https://stackoverflow.com/questions/7964848/sensorportait-typo

Windows Phone - change layout on orientation change

痞子三分冷 提交于 2019-12-06 01:27:11
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 layout, however during some research for this, I learned that maybe the right/best approach would be to

Wrong View Height/Width value on Orientation change?

别等时光非礼了梦想. 提交于 2019-12-06 00:09:54
问题 I implemented onConfigurationChnage(..) to read value of view height and width on orientation configuration chnage @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int height = displaymetrics.heightPixels; int width = displaymetrics.widthPixels; Log.i(TAG, "onConfigurationChanged: "+newConfig.orientation+", "

Disable and enable orientation changes in an activity in Android programatically

故事扮演 提交于 2019-12-05 20:57:00
问题 I have an App that make some background staff. When the background work is running a progress Circle is shown, if the device is rotated during this time then the Activity is "reset" and I want to avoid that. For this reason I decided disable orientation during this process. I have seen differends threads for this question but none with a valid solution, at least in my case. The solutions posted are about fixing the activity orientation but you have to deal with the fact that the REVERSE