android-orientation

How to rotate views on orientation change without recreating layout?

柔情痞子 提交于 2019-12-02 18:22:05
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 create a new different layout in layout-land . Clearly, this is not what I want. I don't want to recreate

How to fix layout orientation to vertical?

我是研究僧i 提交于 2019-12-02 17:22:55
How to fix layout orientation to portrait and do not allow changing from portrait to landscape during run time? In your AndroidMainfest.xml file find the tags of the activities you wish to lock to a given rotation, and add this attribute: android:screenOrientation="portrait" David Choe Use setRequestedOrientation() as shown: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Hardik Gajjar in your activity parameters in Manifest File <?xml version="1.0" encoding=

How to set Android default camera app for portrait orientation only

帅比萌擦擦* 提交于 2019-12-02 16:08:33
问题 In my android application I am capturing photo using Android default camera for this purpose I have used below code.after captured a photo I have shown that Image into another activity in full screen mode.if I captured image in portrait mode I can set the whole image into full screen mode. it showed good, after showed a image I can perform my operation.But if I captured a photo from landscape the taken image would set in screen with stretched. so I would like to capture photo using portrait

Changing number of columns with GridLayoutManager and RecyclerView

大憨熊 提交于 2019-12-02 14:50:37
Inside my fragment I'm setting my GridLayout in the following way: mRecycler.setLayoutManager(new GridLayoutManager(rootView.getContext(), 2)); So, I just want to change that 2 for a 4 when the user rotates the phone/tablet. I've read about onConfigurationChanged and I tried to make it work for my case, but it isn't going in the right way. When I rotate my phone, the app crashes... Could you tell me how to solve this issue? Here is my approach to find the solution, which is not working correctly: @Override public void onConfigurationChanged(Configuration newConfig) { super

How to set Android default camera app for portrait orientation only

孤街浪徒 提交于 2019-12-02 12:49:41
In my android application I am capturing photo using Android default camera for this purpose I have used below code.after captured a photo I have shown that Image into another activity in full screen mode.if I captured image in portrait mode I can set the whole image into full screen mode. it showed good, after showed a image I can perform my operation.But if I captured a photo from landscape the taken image would set in screen with stretched. so I would like to capture photo using portrait mode only not in landscape. so how may I lock camera app only for portrait. String fileName = "Camera

ABS + ViewPager + manage orientation change

孤人 提交于 2019-12-02 10:22:06
问题 I am currently trying to implement an application with several Tabs and i must use also ViewPager. The difficulty i'm facing is to manage screen orientation changes... Let me explain more in detail.. In portrait there is a player full screen (1fragment), in lanscape i want it to change to a list at the left and a player at the right (2fragment) For now viewPager is blocking me, i've search through the internet and found nothing for this issu with abs + viewpager. I think the problem can be

CoreLocation heading Android

眉间皱痕 提交于 2019-12-02 07:49:30
问题 I am currently working on an algorithm which requires an accurate estimate of the heading of the mobile device. For the development in iOS, I do not have to estimate the user heading as the framework already provides the value of trueHeading via CoreLocation framework. So I do not have to implement my own fusion algorithm. The beauty of this trueHeading is that it is very accurate and very stable, specially when the device is resting. This enables me to troubleshoot my algorithm. Now, I am

ABS + ViewPager + manage orientation change

蓝咒 提交于 2019-12-02 04:39:33
I am currently trying to implement an application with several Tabs and i must use also ViewPager. The difficulty i'm facing is to manage screen orientation changes... Let me explain more in detail.. In portrait there is a player full screen (1fragment), in lanscape i want it to change to a list at the left and a player at the right (2fragment) For now viewPager is blocking me, i've search through the internet and found nothing for this issu with abs + viewpager. I think the problem can be related to the adapter. For now it takes a "Class" variable and instanciate the fragment from it. Do you

Keyboard dismissed on rotation to landscape mode Android

瘦欲@ 提交于 2019-12-01 08:29:04
Running into a strange problem. When I'm on portrait and have the keyboard visible and rotate to landscape, the keyboard is dismissed (with or without text in the EditText ). The text is also retained on rotation. When I'm on landscape and have the keyboard visible and rotate to portrait, the keyboard continues to be visible on portrait. Any idea what could be going wrong? I'm not handling configChanges myself and I don't intend to. I also tried using stateUnchanged | adjustResize in the XML and that did not change anything. 来源: https://stackoverflow.com/questions/39173171/keyboard-dismissed

onConfigurationChanged is not getting called any time in android

左心房为你撑大大i 提交于 2019-12-01 07:26:04
问题 I have create sample program to test Orientation. If portrait mode and I tilt the phone the other way round I want my sample app to reversePortrait. After reading lot of questions on this - Figured we need to need use: onConfigurationChanged(Configuration newConfig) I was trying out the following: @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Configuration c = getResources().getConfiguration(); Log.e("Config",""+c); if (c