I\'m searching for useful Android Studio keyboard shortcut for commenting code, as in Sublime Text or Eclipse.
When I press either cmd+/ or
Keyboard shortcuts can be configured (and reviewed) via the Settings dialog, accessible via File -> Settings
.
Once this dialog appears, to review (and/or add) a shortcut, do the following:
Select Keymap in the list on the left. Note that there is a "Keymaps" option, and depending on the original selection, shortcuts assigned to a given feature differ based on the Keymap.
Type "comment" or text corresponding to the feature for which the keyboard shortcut is to be reviewed/assigned. Each match has a line entry in the list below, and keyboard shortcuts are shown right-justified along with the feature. For example, both CTRL+ALT+SLASH and CTRL+K, CTRL+C are the two assignments for creating a line comment.
To modify a shortcut:
In Android studio CTRL + SHIFT + / for windows.
In LINUX
1.Single line commenting. Ctrl + /
2.For block comment Ctrl + Shift + /
Ctrl + Shift + / works well for me on Windows.
Line Comment hold both: Cmd + /
Block Comment hold all three: Cmd + Alt + /
Line Comment hold both: Cmd + + =
Block Comment hold all three: Cmd + Alt + + =
Line Comment hold both: Ctrl + /
Block Comment hold all three: Ctrl + Shift + /
Same way to remove the comment block.
To Provide Method Documentation comment type /**
and press Enter just above the method name (
It will create a block comment with parameter list and return type like this
/**
* @param userId
* @return
*/
public int getSubPlayerCountForUser(String userId){}
on mac, using uk english keyboard layout to reach quickcomment in android studio the key combination is:
cmd + alt(option) + /