How to Preview Layout on Different Android API Levels

In the projects we develop in MobileMonsters we generally follow the Material Design Guidelines. So we get advantages of Android Support Design Library or third party implementations of material components.

After designing the xml layout files we sometimes need to check if the user will get the expected UI design on different API levels.

To preview the layout designs on pre-lollipop and post-lollipop devices without actually installing the app to the emulator or a real device, we use Android Studio’s built-in Layout Editor.

However, you may see that you don’t have all of the API versions available in your layout editor or preview tab.

We have only three options, for now.

To install the missing API versions in Layout Editor, you should install relevant platform tools. For example, if you want to add API 16 option to your preview, you should follow these steps:

On Android Studio,

  • Go to Tools > Android > SDK Manager
  • Click Launch Standalone SDK Manager
  • Check Android 4.1.2 (API 16) > SDK Platform
  • Click Install 1 package…
  • Accept the licence and install the package.
Select SDK Platform under API 16.

After restarting Android Studio, you will be able to see API 16 option in your layout editor.

API 16 is available in the menu.

Hope this posts saves you some time.

by Safa with ❤ from MobileMonsters HQ