orientation

What is the best method of re-rendering a web page on orientation change?

给你一囗甜甜゛ 提交于 2019-12-17 05:51:33
问题 I have a fluid CSS layout which is rendering badly on an iphone when I change the orientation. (It looks fine when it is refreshed). I am using the code below to refresh the page on orientation change, which works fine - it just feels a little wrong doing so. Is there any way of achieving this without having to reload the entire page? It is a mobile site, I don't really want to force the user to load the page twice. var supportsOrientationChange = "onorientationchange" in window,

What is the best method of re-rendering a web page on orientation change?

无人久伴 提交于 2019-12-17 05:51:26
问题 I have a fluid CSS layout which is rendering badly on an iphone when I change the orientation. (It looks fine when it is refreshed). I am using the code below to refresh the page on orientation change, which works fine - it just feels a little wrong doing so. Is there any way of achieving this without having to reload the entire page? It is a mobile site, I don't really want to force the user to load the page twice. var supportsOrientationChange = "onorientationchange" in window,

How to lock orientation during runtime

我的梦境 提交于 2019-12-17 03:48:51
问题 Is there a way to lock orientation during runtime? For example I'd like to allow the user to lock the screen to landscape if the user currently in landscape and toggle the menu option. 回答1: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Called on an activity, will lock it to landscape. Look for the other flags in the ActivityInfo class. You can lock it back to portrait or make it sensor/slider driven. More info here: http://www.devx.com/wireless/Article/40792 回答2: Be

how to detect orientation of android device?

≡放荡痞女 提交于 2019-12-17 03:35:12
问题 Is it possible simple to detect current orientation of android device, without programming a listener and handling the position matrix? In my app I want only to know current orientation - vertical or horizontal - at the moment. However I don't want to listen to events of axiometry or other events. 回答1: Use the getRotation method: Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int rotation = display.getRotation(); From the

Camera orientation issue in Android

孤人 提交于 2019-12-17 02:54:13
问题 I am building an application that uses camera to take pictures. Here is my source code to do this: File file = new File(Environment.getExternalStorageDirectory(), imageFileName); imageFilePath = file.getPath(); Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); //Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); startActivityForResult(intent, ACTIVITY_NATIVE_CAMERA_AQUIRE); On onActivityResult() method, I

How do I reset the scale/zoom of a web app on an orientation change on the iPhone?

喜欢而已 提交于 2019-12-17 02:34:10
问题 When I start my app in portrait mode, it works fine. Then I rotate into landscape and it's scaled up. To get it to scale correctly for the landscape mode I have to double tap on something twice, first to zoom all the way in (the normal double tap behavior) and again to zoom all the way out (again, the normal double tap behavior). When it zooms out, it zooms out to the correct NEW scale for landscape mode. Switching back to portrait seems to work more consistently; that is, it handles the zoom

Lock screen orientation (Android) [duplicate]

会有一股神秘感。 提交于 2019-12-17 02:20:55
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to disable orientation change in Android? I'm writing an android application that uses tabs with different contents (activities). In one of these activities, I would like to lock the screen orientation to "Landscape"-mode, but in the other activities, I want the normal orientation (according to sensor). What I'm doing now is that I'm calling setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

检测设备横屏 || 竖屏的状态

≯℡__Kan透↙ 提交于 2019-12-17 02:07:55
JavaScript方式检测横屏 window.orientation:获取屏幕旋转的方向 window.addEventListener("resize", ()=>{ if (window.orientation === 180 || window.orientation === 0) { console.log('竖屏'); }; if (window.orientation === 90 || window.orientation === -90 ){ console.log('横屏'); } }); CSS方式检测横屏 @media screen and (orientation: portrait) { /*竖屏...*/ } @media screen and (orientation: landscape) { /*横屏...*/ } 来源: https://www.cnblogs.com/Model-Zachary/p/10888761.html

Android WebView: handling orientation changes

时光总嘲笑我的痴心妄想 提交于 2019-12-17 01:35:32
问题 The issue is the performance following rotation. The WebView has to reload the page, which can be a bit tedious. What's the best way of handling an orientation change without reloading the page from source each time? 回答1: If you do not want the WebView to reload on orientation changes simply override onConfigurationChanged in your Activity class: @Override public void onConfigurationChanged(Configuration newConfig){ super.onConfigurationChanged(newConfig); } And set the android:configChanges

Android - Camera preview is sideways

人走茶凉 提交于 2019-12-16 20:41:42
问题 I am using a Preview to display what the camera see's on the screen. I can get everything working fine, surface created, surface set and the surface is displayed. However it always displays the picture at an incorrect 90 degree angle in portrait mode. Such as in the picture: I am aware that using the following code will set the picture straight: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); However I have the Preview within an Activity that has other elements in it and