Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Emulator UI breaks on orientation changed

Currently I have a strange issue on Android Studio 4.1 with my emulators. When I'm trying to change the orientation to landscape the ui of the emulator is completely breaking... This is how it looks like:

enter image description here

Has anyone an idea why this is happening? I changed the emulator performance in the AVD settings to "Software" after that it does not happen but it is very slow.

like image 414
Funkberater Avatar asked Nov 16 '20 12:11

Funkberater


People also ask

How do I change the orientation of my Android emulator?

Android Emulator Shortcuts Ctrl+F11 Switch layout orientation portrait/landscape backwards Ctrl+F12 Switch layout orientation portrait/landscape forwards 1.

How to prevent restarting when keyboard orientation changes in Android?

The "keyboardHidden" value prevents restarts when the keyboard availability changes. If you want to manually handle orientation changes in your app you must declare the "orientation", "screenSize", and "screenLayout" values in the android:configChanges attributes.

What happens to asynctasks after orientation change in Android?

When Android destroys your Activity or Fragment because of an orientation change (or any other configuration change), it will not destroy any AsyncTasks that you started.

Is it hard to handle orientation changes on Android?

Handling orientation changes on Android is one of the most frustrating things to deal with as an Android engineer. I hope to make that challenge just a little bit easier and to help you better understand exactly what’s happening when you rotate your Android device.


1 Answers

As already pointed out, setting emulator graphics options to "Software" helps as a temporary fix.

I would like to add that if you can't change the settings in the AVD Configuration (in my case graphics were automatic, the field was readonly), you can do that manually:

  1. on AVD Manager, right-click on the desired device, then "Show on Disk"
  2. look for the config.ini of the device and open it
  3. change "hw.gpu.mode = auto" to "hw.gpu.mode = software"

This worked for me. Hope it helps someone else to avoid headaches.

like image 78
Giovanni Londero Avatar answered Sep 29 '22 19:09

Giovanni Londero