portrait

Android Device onConfigurationChanged event does not handling orientation

荒凉一梦 提交于 2019-12-01 05:50:33
问题 i have an activity and on startup of the activity i need to change the orientation in lanscape and then later on i want to handle both orientation changes as user rotates device , but it once changes the orientation and later on does not change the orientation. here is my code please help public class Hls extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hls); setRequestedOrientation(ActivityInfo

Issues taking picture with Android (Vertical Camera | Portrait)

六月ゝ 毕业季﹏ 提交于 2019-11-30 22:40:05
With the following code shows a preview of the camera vertically and it's works.. BUT!! I get a photo in landscape! :( How I can build it vertically? I've the preview view in vertical, but I can't save the picture vertically. greetings and thanks, Fran ONCLICK public void onClick(View arg0) { camera.takePicture(myShutterCallback, myPictureCallback_RAW, myPictureCallback_JPG); } PREVIEW @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if (previewing) { camera.stopPreview(); previewing = false; } if (camera != null) { /* * camera.setPreviewDisplay

How do I lock screen orientation for phone, but not for tablet? (Android)

核能气质少年 提交于 2019-11-30 17:24:58
I have been working on a Android project, that is intended to be compatible with both the Android phones and tablets. On the tablet the app is working great and looks good too. However, on the phone we have been running into issues both programmatically and layout wise (working with a 10.1 inch screen is a lot easier than a 4 inch screen). To solve some of these problems we have decided to deactivate screen orientation but only for the phone version, atleast temporarily. The question is simple, how do I deactivate the screen orientation for Android phone, while keeping it active for the

android多分辨率多屏幕密度下UI适配方案

人走茶凉 提交于 2019-11-30 08:36:56
前言 Android 设计之初就考虑到了 UI 在多平台的适配,它本身提供了一套完善的适配机制,随着版本的发展适配也越来越精确, UI 适配主要受平台两个因素的影响:屏幕尺寸(屏幕的像素宽度及像素高度)和屏幕密度,针对不同的应用场景采用的适配方案也不一样,此文档仅针对 Android4.0 及以下版本 相关概念 分辨率: 整个屏幕的像素数目,为了表示方便一般用屏幕的像素宽度(水平像素数目)乘以像素高度表示,形如 1280x720 ,反之分辨率为 1280x720 的屏幕,像素宽度不一定为 1280 屏幕密度: 表示单位面积内的像素个数,通常用 dpi 为单位,即每英寸多少个像素点 px : 长度单位,以具体像素为单位 dp : 长度单位,与具体屏幕密度无关,显示的时候根据具体平台屏幕密度的不同最终转换为相应的像素长度,具体转换规则是 : 1dp = (目标屏幕密度 / 标准密度) *px, 标准密度为 160dpi ,例如, 1dp 长度在密度为 160dpi 的平台表示一个像素的长度,而在 240dpi 的平台则表示 1.5 个像素的长度 屏幕尺寸: 屏幕的大小,通常用屏幕对角线的长度表示 Android 界面适配机制 UI 界面在不同平台的适配受屏幕尺寸和屏幕密度影响, Android 适配机制就是在资源后面添加对这两种因素的限定,通过不同的限定区分不同的平台资源,

why does CSS background-size: cover not work in portrait mode on iOS?

泪湿孤枕 提交于 2019-11-30 03:51:37
I'm trying to set up a manualy splash-image across devices. I'm doing so by checking for orientation (touch devices) or screen width vs. screen height (none touch) and set a url accordingly. Then I add this CSS rule via Javascript: document.styleSheets[3].insertRule('.initHandler:before { background: url('+x+') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }', 0) With x being the image to be loaded depending on orientation and screen size. My problem is this works fine in landscape mode, but on my

xcode - How do I keep views locked into portrait mode, but still allow one view to rotate?

依然范特西╮ 提交于 2019-11-29 15:38:12
问题 I'm having a problem with device rotation. Except for ONE view, where I show a company splash screen, I want to lock all the remaining app views into Portrait display. In the project settings the supported orientations are Portrait and LandscapeLeft. In the 'Company Splash' it works fine and the view rotation is locked into LandscapeLeft no matter how I rotate the device. On all the other views when I rotate the device to the left the view alters instead of staying in portrait display. The

zxing camera portrait mode and landscape on android

你说的曾经没有我的故事 提交于 2019-11-29 07:42:27
I have already integrated zxing library in my application. Now i want that zxing camera will work on both mode landscape as well as on portrait mode. now it is working on one mode only. Can somebody help me out how to do this? I used compyutech 's answer, but there were some things missing. So, I'm putting everything required, here. 1. CameraConfigurationManager : inside initFromCameraParameters method : if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { camera.setDisplayOrientation(90); } also remove this code from same method : if (width <

How to convert & rotate raw NV21 array image (android.media.Image) from front cam portrait mode in onImageAvailable (android Camera2)?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 02:46:30
Note: All info in my post only goes for Samsung Galaxy S7 device. I do not know how emulators and other devices behave. In onImageAvailable I convert continuously each image to a NV21 byte array and forward it to an API expecting raw NV21 format. This is how I initialize the image reader and receive the images: private void openCamera() { ... mImageReader = ImageReader.newInstance(WIDTH, HEIGHT, ImageFormat.YUV_420_888, 1); // only 1 for best performance mImageReader.setOnImageAvailableListener( mOnImageAvailableListener, mBackgroundHandler); ... } private final ImageReader

why does CSS background-size: cover not work in portrait mode on iOS?

為{幸葍}努か 提交于 2019-11-29 01:23:59
问题 I'm trying to set up a manualy splash-image across devices. I'm doing so by checking for orientation (touch devices) or screen width vs. screen height (none touch) and set a url accordingly. Then I add this CSS rule via Javascript: document.styleSheets[3].insertRule('.initHandler:before { background: url('+x+') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }', 0) With x being the image to be

Lock Android phone application to Portrait mode

情到浓时终转凉″ 提交于 2019-11-28 17:07:48
Can someone tell me how to lock my application to a portrait mode? Is it a simple configuration in the manifest file? techiServices Yes. Add android:screenOrientation="portrait" to the manifest under your main activity. <activity android:name=".yourActivity" android:screenOrientation="portrait"... /> Yes! It's an attribute of the activity tag: <activity android:name=".yourActivity" android:screenOrientation="portrait" ... /> Also, you may have to add the following to your activity element: android:configChanges="keyboardHidden" That way, the OS won't change the orientation when the user opens