tempCanvas.drawArc(cx - mInnerCircleRadius, cy + mInnerCircleRadius,cy + mInnerCircleRadius,cy + mInnerCircleRadius);
For example, the above code i
File> Settings > Editor > Code Style > Kotlin > 'Set from...' - 'Predefined Style' - 'Kotlin style guide'
when you want to use predefined code style for Kotlin in Android Studio/Idea (general rules from Coding Conventions)
As a reminder to others visiting this question, you can also manually add line breaks by hitting enter after the commas or other appropriate places in the code. Android Studio will automatically indent it. This makes long lines more readable.
tempCanvas.drawArc(
cx - mInnerCircleRadius, // You can also add comments
cy + mInnerCircleRadius, // to different parts of a line
cy + mInnerCircleRadius, // this way.
cy + mInnerCircleRadius);
On the latest Android Studio:
File > Settings > Editor > Code style > Java > Wrapping and Braces
do not wrap
to wrap if long
for all the itemsctrl + Alt + L
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 in Preferences
on Mac OS.
To do this in Android Studio go to
File > Settings > Editor > Code Style
and set Right margin (columns)
to 120
(or the line width you want)
Now go to
File > Settings > Editor > Code Style > Java > Wrapping and Braces (tab)
and check
the checkbox Ensure right margin in not exceeded
Apply the changes and press OK
Now in the editor, to format your code to that line width, press:
Code > Reformat Code...
Done
In Mac OS instead of File > Settings
go to Preferences
, follow the same steps.
If you don't wanna wrap a line:
File
-> Settings
-> Editor
-> Soft Wraps
-> Uncheck Use soft wraps in editor
You can make it automatically for all files by
Editor
-> General
-> Soft-Wraps
, check the Soft-wrap files
and input needed filetype (for example *.java) in input field, now any new and even opened files will autowrap long strings. No any additional actions needed.