Objective
Will you miss Eclipse's method annotation template when you move from Eclipse to Android studio?
Hit /** plus enter , the template comes out, and Android studio can't be customized (or I can't find it)
Now I've found a way to use Live templates
Steps
1.file->setting->editor->live Templates
2. Click + to create a template Group
2. Fill in the group name you want, my name is custom
3. Select the group you just created to create the live Template
4. Fill in the abbreviation, I filled in here is CMT, that is, you this note shortcut, you knock CMT Plus Enter, the template is out
Templates text is a template for comments, specific to how you want to write the template can be, my template is as follows
5. To set up your CMT shortcut key where it takes effect, my choice is to take effect at the time of Declaration, that is, you can play CMT plus carriage return on the method name.
6. Note that my template text has a definition of three variables desc,date,time, the next two I want to generate date and time, so we want to edit these two variables
Click Edit variables, in the pop-up window for date and time is to set the corresponding method, date () This method will generate a date, this method will generate
7. Click Apply to complete. Now, you just hit the CMT in the method name to enter, will automatically generate a note template, the effect is as follows, time is automatically generated
Customizing the Android Studio method Comment Template