Search code examples
androidkotlinandroid-emulatorandroid-jetpack-compose

Android Studio how to resize emulator without aspect ratio constraint


I'm building a responsive layout with jetpack compose, and I want to test the responsiveness by dragging a corner of the emulator to resize it. However, it preserves the aspect ratio and just scales it, which doesn't help me at all. How can I easily test my responsive layout without having to create a bunch of virtual devices at different sizes?


Solution

  • I found a decent solution from the experimental developer setting "Enable freeform windows" and this article: https://www.floatingapps.net/freeform

    Steps:

    1. Turn on developer mode
    2. In Settings -> Developer options, turn on these settings under "Apps":
      • "Force activities to be resizable"
      • "Enable freeform windows"
    3. Reboot the virtual device
    4. Open your app
    5. Open "Overview" mode
    6. Long press on the app icon in the header and select "Freeform". You can now drag the corners of the app.