Customizing the Android Studio method Comment Template

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.