UI is not changing as expected while changing orientation in android - android

Here I am using different UX designs for portrait and landscape mode for a particlular activity. Created the folders layout-sw600dp and layout-sw600dp-land ,layout-sw720dp and layout-sw720dp-land for portrait and landscape mode. But the corresponding UX is not displayed while changing the mode. That is it loads the launching mode's expanded version while rotating the device. This means it will show the expanded version of landscape design while changing that to portrait. Tried the below code in the manifest. But no hope.
android:configChanges="keyboardHidden|orientation|screenSize"

Related

When we changed the orientation Portrait to Landscape and vice-versa in Fragment then it can't take the design from specific layout folder

I am having problems in Fragment when Orientation changed from Portrait to Landscape and vice-versa then layout design will not take it from specific layout.
Example
Currently in my project have different layouts as below
layout-sw600dp (Generally it is used for Portrait Tablet layout design or depends on orientation)
layout-sw600dp-land (Generally it is used for Landscape Tablet layout)
There is Home screen fragment design for Portrait and Landscape Tablet UI.
Currently Home screen is showing in Portrait mode from layout as layout-sw600dp and when we rotate the device Portrait to Landscape then it will not refreshed in terms of design and it will not reflect as a landscape design from layout as layout-sw600dp-land.

ConstraintLayout breaking when switching from Portrait to Landscape mode

Right now I have two different layout files, one for Large and one for large-land. Both are using constraint layouts. However whenever the tablet switches from portrait to landscape mode, the landscape mode layout displays correctly. But after switching back to portrait and back to landscape mode, the landscape layout no longer displays correctly. The right side of the layout seems to have extended past the actual screen.
To simplify,
Portrait -> Landscape: Landscape displays correctly
Portrait -> Landscape -> Portrait -> Landscape: Landscape layout breaks and extends past the screen for some reason.
Any idea why this may be happening? Thanks in advance!

Multi-windows in Android 7.0 - Always get landscape layout even though device in multiwindows portrait mode

I am developing an android application that supports multi-windows feature on Android 7.0.
I followed this guide on https://developer.android.com.
, imported sample project https://github.com/googlesamples/android-MultiWindowPlayground
I create a new resource named layout-land and did some testing. I recognized that landscape layout is inflated even though the device is in portrait mode.
Check out attached images.
How can I set portrait layout when device is in portrait mode.
Assume you have two screens. One is in landscape and one in portrait.
How can you say which one is in landscape and which one in portrait?
In portrait width of the screen is less than height.
And for landscape width of the screen is greater than height.
Agree?
So, here, when you enter multiwindow mode your app's window no longer fits screen - width is greater than height and it is considered as landscape.
That is why landscape layout resource is used.
There is no separate modifier for layout resource to be used in split-screen mode.
The only thing you can do to achieve portrait in your case is to remove layout-land.
Or you can create two separate layouts (without any modifiers such as -land) and in activity call activity.isInMultiWindowMode(); to choose corresponding layout you want to use.

Android Layout Folder for Devices/Tablets which are always in Landscape

I'm developing an android app for phones and tablets.
I want all of the devices to use portrait layout. I made a 'layout' folder for it. But, there are some X number of devices which are always in landscape mode. Probably, large tablets. So, I made a 'layout-land' folder too.
Which folder I need to add so that X amount devices will always display landscape layout only, while other devices will always display portrait layout?
Main requirement is to have only portrait layouts displayed. But, display Landscape layout when device itself is in landscape mode(default). I am talking about devices that display drawer in landscape mode, and the ones that open landscape layout of apps only.
Is this automatic?
I have android:screenOrientation="portrait" in manifest.
I can't test this as I don't have a tablet/large device.
I have already looked at this question and other similar questions.
Add the below line in your onCreate() method before setContentView()
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORT‌​RAIT);

Minimum screen size in android for fragments to be seen

I m trying to run the code given here - http://code.google.com/p/android-honeycomb-fragment-tutorial/source/browse/#svn%2Ftrunk%253Fstate%253Dclosed on a 7 inch emulator in portrait or landscape using the android support package. Well from the code its obvious portrait shouldn't show up the fragments but neither is landscape.
But no matter what I do I am not able to see the fragments in the screen. Is there a minimum screen setting for seeing the different fragment screens in Android?
There is no minimum screen setting for fragments to be show on Android.
You see only one fragment because they have a single fragment in both the activities in the Portrait mode.
Portrait : http://code.google.com/p/android-honeycomb-fragment-tutorial/source/browse/trunk/res/layout/main.xml
In the Lanscape mode there are two fragments shown, and these should show up
Landscape : http://code.google.com/p/android-honeycomb-fragment-tutorial/source/browse/trunk/res/layout-land/main.xml

Categories

Resources