Comment shortcut Android Studio

后端 未结 24 2659
野趣味
野趣味 2020-12-22 19:55

I\'m searching for useful Android Studio keyboard shortcut for commenting code, as in Sublime Text or Eclipse.

When I press either cmd+/ or

相关标签:
24条回答
  • 2020-12-22 20:15

    Mac (French-Canadian Keyboard):

    Line Comment hold both: Cmd + É

    Block Comment hold all three: Cmd + Alt + É

    "É" is on the same position as "?/" in english one.

    0 讨论(0)
  • 2020-12-22 20:15

    Are you sure you are using / and not \ ? On Mac I have found by default:

    • Cmd + /

    Comments using // notation

    • Cmd + Opt + /

    Comments using /* */ notation

    0 讨论(0)
  • 2020-12-22 20:16

    I am working with a german keyboard and the slash (/) is on the 7 key, meaning access would be Ctrl + Shift + 7. However, this does not work as this is predefined as something with bookmark 7.

    I went to settings (search for keymap) and deleted all existing shortcuts. I than added Ctrl + 7, confirmed deletion of bookmark shortcut and now can work well.

    0 讨论(0)
  • 2020-12-22 20:16

    For Line Comment: Ctrl + /

    For Block Comment: Ctrl + Shift + /

    0 讨论(0)
  • 2020-12-22 20:18

    In spanish keyboard without changing anything I can make a comment with the keys:

    cmd + -

    OR

    cmd + alt + -

    This works because in english keyboard / is located at the same place than - on a spanish keyboard

    0 讨论(0)
  • 2020-12-22 20:18

    Comment method like pro developers:

    Windows/linux:

    Line Comment : Ctrl + /

    Block Comment : Ctrl + Shift

    Method Commenting:

    Type `/**` and press `Enter Key`
    

    it will add the comment snippet like we see in standard documentation, give it a try this once.

    /**
     * 
     * @param addOpacity
     */
    public void setOpacityOnUserImage(boolean addOpacity) {
    // Your business logic. 
    }
    
    0 讨论(0)
提交回复
热议问题