Android Studio: how to remove/update the “Created by” comment added to all new classes?

后端 未结 9 1353
余生分开走
余生分开走 2020-12-07 07:53

By default Android Studio automatically adds a header comment to all new classes, e.g.

/**
 * Created by Dan on 11/20/13.
 */

Where is the

相关标签:
9条回答
  • 2020-12-07 08:27

    As well as Dan's answer (which is the much more rigorous way), you can also click into the header, and option-enter (on Mac), and you can choose to edit the default file template. Alternatively, click the little lightbulb to get here as well

    enter image description here

    0 讨论(0)
  • 2020-12-07 08:35
    1. Press ctrl+shift+A
    2. Type : File and Code Templates.
    3. Look for File Header under Includes
    4. You can type something like below

    0 讨论(0)
  • 2020-12-07 08:36

    You can overwrite the ${USER} variable in the template file with the #set( $VARIABLE = "value") function.

    On windows: Press Ctrl+Alt+S and go to Settings -> File and Code Templates -> Includes -> File Header

    On Mac: Android Studio -> Preferences -> Editor -> 
    File and Code Templates -> Includes -> File Header
    

    prepend the #set() function call, for example:

    #set( $USER = "YourName" )
    /**
    * Created by ${USER} on ${DATE}.
    */
    
    0 讨论(0)
提交回复
热议问题