I\'m searching for useful Android Studio keyboard shortcut for commenting code, as in Sublime Text or Eclipse.
When I press either cmd+/ or
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.
Are you sure you are using / and not \ ? On Mac I have found by default:
Comments using // notation
Comments using /* */ notation
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.
For Line Comment: Ctrl + /
For Block Comment: Ctrl + Shift + /
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
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.
}