Tips for using AndroidStudio

1. Automatic package import

Open File->Settings->Editor->General->Auto Import, check: (as shown below)

Add unambiguous imports on the fly   

Optimize imports on the fly(for current project)

The package where the class is located can be automatically introduced when writing code.

2. Class file comment template

Open File->Settings->Editor->File and color Templates, select includes -> File Header on the right

Fill in the annotation style you want, and just apply. There are some dynamic adaptation attributes listed in it, which you can choose by yourself.

In this way, comments at the beginning of the newly created class file will automatically apply this template

3. Customize the shortcut comment template

Open File->Settings->Editor->Live Templates, click the "+" sign on the right to create a new template, enter the name "cm" (custom),

Fill in your comment template in Temple text, you can define variables in the template, the format is "$xxx$", click Edit variables to set the meaning of the variable, Expression is the value type of the variable, user() is the current user, date( ) is the date

Finally, just apply. Enter cm in the class and press Enter to quickly add comments.

Guess you like

Origin blog.csdn.net/gs12software/article/details/103238527