Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comment shortcut Android Studio

People also ask

What is the shortcut for comment?

Select the Code to Comment. Press Ctrl + K . Press Ctrl + C .

How do you comment on android?

you can also add comment by pressing Ctrl+shift+/ and shift+ / for one line.

What is the shortcut key for comment in C#?

Shortcut: You can use Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U to Comment or Uncomment selected lines of text. Comments are used to help document what a program does and what the code with it does.


Mac With Numeric pad

Line Comment hold both: Cmd + /

Block Comment hold all three: Cmd + Alt + /

Mac

Line Comment hold both: Cmd + + =

Block Comment hold all three: Cmd + Alt + + =


Windows/linux :

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){}

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


Be sure you use the slash (/) on right side of keyboard.

For Line Comment:

Ctrl + /

For Block Comment:

Ctrl + Shift + /

You can see all keymap in Android Studio: Help ➤ Default Keymap Reference


On Mac and Turkish Keyboard it is (both for commenting out and uncommenting)

line comment: cmd +.

block comment: cmd+alt +.


An Example for a Mac OS X 10.5+ with a German layout keyboard without NumPads:

  1. Open Preferences
  2. Search for "Keymap"
  3. Expand "Main menu"
  4. Expand "Code"
  5. Delete all shortcuts (just a suggestion)
  6. Add a shortcut for a single line comment (e.g. Ctrl++)
  7. Add a shortcut for a block comment (e.g. Ctrl+alt +)
  8. This way you can be sure that those keys are not mapped (except if you assigned them before to another function)

    enter image description here


Reviewing and Changing Keyboard Shortcuts in Android Studio

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:

Modify shortcut dialog

  1. 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.

  2. 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:

  1. Select the resultant line corresponding to the feature for which the keyboard shortcut is to be reviewed/assigned
  2. Right-click, and select the desired Add or Remove option.