tempCanvas.drawArc(cx - mInnerCircleRadius, cy + mInnerCircleRadius,cy + mInnerCircleRadius,cy + mInnerCircleRadius);
For example, the above code is too long, so I want to break the line at every ,
. Eclipse will do it but Android Studio won't break the line when I hit format code
. Is there any method to do it?
when you want to use predefined code style for Kotlin in Android Studio/Idea (general rules from Coding Conventions)
If you don't wanna wrap a line:
File
->Settings
->Editor
->Soft Wraps
-> UncheckUse soft wraps in editor
File -> Settings > Editor > Code Style.
Then select Wrap on typing CHECKBOX.
Or right click on the divider where you can choose to show line numbers, and click 'Use soft wraps'
This won't break your code at your commas, but it will wrap your code so it's not too long to read.
In Android Studio (and probably any other IDE) you don't break (wrap) lines by
,
or any other character, you define a maximum line width and set the formatter to ensure the maximum line width is not exceeded.You do that on
File -> Settings
on Windows, or inPreferences
on Mac OS.To do this in Android Studio go to
and set
Right margin (columns)
to120
(or the line width you want)Now go to
and
check
the checkboxEnsure right margin in not exceeded
Apply the changes and press OK
Now in the editor, to format your code to that line width, press:
Done
In Mac OS instead of
File > Settings
go toPreferences
, follow the same steps.On the latest Android Studio:
File > Settings > Editor > Code style > Java > Wrapping and Braces
do not wrap
towrap if long
for all the itemsctrl + Alt + L