Comment shortcut Android Studio

后端 未结 24 2660
野趣味
野趣味 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:19

    On PC it's by default set to Ctrl + /. This will toggle commenting a selection or current line.

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

    For multiline comment in android studio

    select the statement that you want to commented then

    use ctrl+shift+/

    and for removing mutiline comment 
    
    select the statement that you want to uncommented then
    
    use **ctrl+shift+/**
    

    SINGLE LINE COMMENT

    For single line comment

    use ctrl+/

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

    If you are used with Eclipse, there is something in Settings>Keymap Keymaps: and you can pick Eclipse to keep the same shortcuts.

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

    I use this sequence (not a 'linear' shortcut but useful anyway):

    • alt+c then alt+b (holding alt) for block comment
    • alt+c then alt+l (holding alt) for line comment

    (they use the android studio menu)

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

    In android studio you can do single comment with (go to line then Ctrl+/) and block comment with ( select text then Ctrl+Shift+/)

    Also if you want to change color of commented text go to File->Settings->IDE settings->Editor->Color & fonts->Java->(Line comment or block comment) and change properties. I prefer it to be green which is used in notepad++ editor.

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

    For Line Comment hold both:

    Ctrl + /

    For Block Comment hold all three:

    Ctrl + Shift + /

    Same way to remove the comment block.

    0 讨论(0)
提交回复
热议问题