Live Templates are a compose-related tool added to Android Studio that allows you to enter code snippets for fast insertion by typing an abbreviation corresponding to a template abbreviation. Live Templates can help you optimize everyday tasks and speed up your work.
For example, when working with Compose, you can type:
compto set up a
prevto create a
paddpto add a
paddingModifier in dp
weightto add a
WCto surround the current composable with a
Built-in Live Templates
You can find the Live Templates settings in Android Studio – File > Settings > Editor > Live Templates.
Here you can see the abbreviations, descriptions, and template text for each of the Live Templates. For example, this is the Live Template for creating a composable function:
Custom Live Templates
Furthermore, besides the built-in Live Templates, you can create your own custom templates. By pressing the add icon on the right side, you can select to add a new Live Template or Template group:
When creating a Live Template, you can select the abbreviation, description, and template text to be something that can benefit your daily work.
If you haven’t used Live Templates yet, now is your chance to check them out and find or create the ones that will help you in your daily work.