Android Code Style for Comments
I am writing code for some of our Android projects. I would like to facilitate this by using Android Studio's Code Style Preferences. I almost followed the options settings: Android Studio-> Preferences-> Editor-> Code Style-> Java.
One thing I'm missing is that we want the comments to be formatted like this:
// a useful comment
Instead:
//a useful comment
How to tell Android Studio but the space between the forward slash and the text in a comment? Thank!
source to share
If you hit CTRL /
or CMD /
, it will place //
at the beginning of the line and the comment will be indented correctly.
// comment with two indents
This needs to be done Comment at first column
in Editor->CodeStyle->Java->Wrapping and Braces->Keep when reformatting
as mentioned in the other answer.
If you want to write a multi-line comment, you can use CTRL SHIFT /
or CMD SHIFT /
This way, when you enter a new line, you will have one place after the start of the comment
/*
* there is space before this*/
source to share