android-orientation

Android: Rotate only overlay Buttons on camera preview

99封情书 提交于 2019-12-22 04:42:13
问题 I have an Android application using LinearLayout as main layout with a SurfaceView filled by camera preview. In this I inflate another LinearLayout with three Buttons and a custom TextView. I would like the camera preview to stay always in Landscape orientation and the overlay layout changing according to the device orientation. I tried setting android:screenOrientation="landscape" in the manifest for the activity but then (of course) also the inflated layout stays always fixed, while not

Android: set activity orientation BEFORE onCreate, but not in manifest (HDMI plugged in issue)

北城余情 提交于 2019-12-21 21:27:34
问题 I can perfectly manage orientation change programatically, by using setRequestedOrientation in onCreate . Everything works really fine, until I plug a HDMI cable. After this, the tablet "wants" to be in landscape mode. So when I open an activity, it shows first in "landscape" and then right after it shows in "portrait", (because I'm calling setRequestedOrientation(variable_with_orientation_desired_by_the_user) where variable=ActivityInfo.SCREEN_ORIENTATION_PORTRAIT in onCreate As you can "see

Activity return to Portrait when Screen is Locked

两盒软妹~` 提交于 2019-12-21 19:53:02
问题 Related questions: https://stackoverflow.com/questions/15648713/strange-behaviour-while-screen-lock-in-landscape This is a strange behaviour i got in my Activities. Portrait mode (It's normal) Press screen lock, Activity: onPause() ; Unlock the screen, Activity: onResume() . Landscape mode (It's strange) Press screen lock, Activity: onPause() -> onStop() -> onDestroy() -> onCreate() -> onStart() -> onResume() which loads the Portrait layout; Unlock the screen, Activity: onPause() -> onStop()

alertdialog is disappears while reload the activity in android

吃可爱长大的小学妹 提交于 2019-12-21 06:55:52
问题 I have to develop an one android application. I have created one alert dialog.If i have to rotate the orientation means that alert dialog is disappears. But i wish to display the alert dialog when orientation changes. @Override public void onConfigurationChanged ( Configuration newConfig ) { super.onConfigurationChanged(newConfig); try { MainActivity.editCalled = true; Intent in = new Intent(AndroidListFragmentActivity.this, AndroidListFragmentActivity.class); startActivity(in); finish(); }

Redraw multiple Paths at same positions from previous layout orientation

好久不见. 提交于 2019-12-21 04:21:55
问题 Based on my previous question of "How to create a BottomBar as StickyBottomCaptureLayout in camera2 Android api?", I created a layout with a StickyBar (SB) which is always locked above/near the system bar. I set the default positions and coordinates of the SB and the other layout in onLayout() (exactly as my answer). The upper layout is a simple custom DrawView which has an ArrayList of Path s drew by the user. When the device rotates, it recalls onDraw() and calls several times canvas

How to rotate views on orientation change without recreating layout?

我的梦境 提交于 2019-12-20 09:18:35
问题 This question has been asked before here but its answer is incorrect. I would like to rotate some views on screen orientation change, but I want to keep the layout unchanged. They should be rotated 90, 180, 270 or 360 degrees according to the current orientation ( SCREEN_ORIENTATION_LANDSCAPE , SCREEN_ORIENTATION_PORTRAIT , SCREEN_ORIENTATION_REVERSE_LANDSCAPE , SCREEN_ORIENTATION_REVERSE_PORTRAIT ). This is what I want to achieve: The answer in the link I mentioned stated that I should

Prevent login screen on screen rotation android

痞子三分冷 提交于 2019-12-20 07:12:07
问题 I have an application in which a login screen shows up whenever an activity goes to onPause state. Generally, when screen orientation changes, the activity goes to onPause state, so I somehow prevented login screen when device is rotated. See the code below, protected void onPause() { super.onPause(); WindowManager mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE); mDisplay = mWindowManager.getDefaultDisplay(); mOrientation = mDisplay.getRotation(); if(mOrientation == 1 ||

Need Help in Changing Screen Orientation in Android

﹥>﹥吖頭↗ 提交于 2019-12-20 04:55:39
问题 I want to change the screen orientation from portrait to landscape and vice versa when the user rotates his Android mobile phone clockwise/anticlockwise. Can anyone help me how to achieve this? I do not know what event is fired when the user rotates his Android mobile phone. For instance, when the user touches the button in UI, touch event is fired. So, when the user shakes his Android mobile phone, what is the event that is fired? Please help me on this. 回答1: Hai, I got Solution with the

Detecting if video was taken in portrait/landscape

江枫思渺然 提交于 2019-12-19 19:47:53
问题 I would like to confirm that what I am doing is indeed the correct way as some elements behave unexpected. First, I have a landscape and portrait layout, as I understand, doing this will automatically detect if the phone is in portrait/landscape mode: - layout - activity_video_player.xml - layout-land - activity_video_player.xml Then when the user selects a video from the gallery, I check if the video was taking in landscape or portrait, by doing this (inside OnCreate ): int w; int h;

Force portrait mode in camera

让人想犯罪 __ 提交于 2019-12-18 06:12:02
问题 I am invoking a camera using an intent and clicking a picture. Presently I am on emulator and would like to force camera to click the pictures in portrait mode(need to capture a video of app working,so orientation change would look bad) but the camera screen appears landscape and all the further activities which I invoke in onActivityResult(). After clicking the picture the Activity layout comes out in landscape mode like this: while all my previous activity have displayed correctly in