How to Stop Android Studio from Opening Kotlin Files in Design Mode
Tired of Android Studio picking the wrong view mode for your code files? Apply this easy one-minute fix to get rid of this frustration forever.

Are you tired of always switching between Design and Code view modes when working with Kotlin files? I totally understand, nothing breaks your flow more than constantly having to press one extra button when opening new files just to see the code inside.
Luckily, Android Studio now has a setting for that, and it's quite smart.
Editor UI Tools
Simply open Settings
-> Editor
-> UI Tools
and in there you find Editor View Mode
. This setting allows you to change between Code
, Design
, and Split
view modes for Kotlin and Resource files. For some reason Android Studio defaulted to Design
mode even for Kotlin code files, when what we want is obviously Code
mode. Maybe the people behind Android Studio are subtly telling us that every programmer should also design? 😅

You can go right ahead and switch the setting to Code
for Kotlin files. For resource files I kept the setting to Split
as I like being able to see both the code and the preview immediately for XML files (for example).
Won't it be annoying when dealing with Compose files?
Normally yes, but it seems the smart developers of Android Studio thought about this already. Right below the Kotlin view mode setting you have a checkbox for "Show split mode if file contains preview annotation", which is exactly what we're looking for.
With this setting plain Kotlin files will open in Code
mode and files containing Compose previews will open directly in Split
mode, enhancing your productivity just one tiny bit more.
Wrapping it up
And that’s it! Android Studio is an amazing piece of software and it's very hard to imagine Android development without it, but sometimes it does come with frustrating bugs or missing settings options with wonky defaults.
Hopefully now you'll no longer get frustrated of Android Studio getting in the way when going down a logic rabbit hole in Code
mode or when eyeballing a padding that just doesn't feel right in Split
or Design
modes.