Android Studio configuration quickly generate template code

Foreword

   Android studio has provided rapid generation template code, in fact, this feature can also customize the configuration. Cipian blog will explain how to use this feature

 

 

Enter select Settings Editor> Live Templates

 

Create your own group

In order not to be confused with the Android studio has built-in model code, we create a group to manage their own template code, see below:

FIG lower Click +, there are two options

1. The first option is to create a new group in the current template code

2. The second is to generate a group, I have created a group called the user

 

Editing code templates

The figure is generated template code edit box, and my template code is my own logging framework to log template.

1.Abbreviation: The input box is a shortcut letter in the code of

2.Description: This is a description of the template code

3. Template text: this is what you need to generate the template code, which I need to quickly enter the generated code, pay attention to the inside of the $ METHOD_NAME $ this is some dynamic text (such as the current method can configure your own name, the current class name, etc.);

4.Edit variables: This button is to configure our $ METHOD_NAME $  in the corresponding content needed

 

If you still do not know, you just need to look at very simple templates to quickly generate the code of Android studio has been built, you can quickly understand.

 

Edit variables page

$ METHOD_NAME $ corresponding content here I chose generation method name methodName ();

 

Guess you like

Origin www.cnblogs.com/guanxinjing/p/11776215.html