Android Studio not saving Device for Preview layout on exit

180 Views Asked by At

Hey all I've been looking far and wide trying to figure out how to save my preview setting's in Android Studio version:

Electric Eel 2022.1.1 Canary 3 Build #AI-213.7172.25.2211.8624637, built on May 20, 2022

Every time I change the Device For Preview to what I am always using (Lenovo Tablet API 29 in the example here):

enter image description here

And also change the orientation to Landscape:

enter image description here

Which should always stay looking like this for not just this layout but all others I have as well:

enter image description here

Then close Android Studio and open it again its right back to what it seems to always default to even though I changed it....

Here is a demo of me opening the Android Studies once to set the settings I am wanting it to save, saving it then exiting. I then start Android Studio again to show that it does not have my saved Device for Preview nor the orientation.

enter image description here

My device is setup correctly to mirror what I have chosen in the Device for Preview:

enter image description here

So, what am I doing wrong?

1

There are 1 best solutions below

0
On

I think that is just a preview option and it doesn't save your app's orientation. But try this code and I hope it will help you.

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

You need to add this code in each relevant java activity of its layout.