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?
Install the Dart plugin (see Editor setup) to get automatic formatting of code in Android Studio and IntelliJ. To automatically format your code in the current source code window, use Cmd+Alt+L (on Mac) or Ctrl+Alt+L (on Windows and Linux).
After opening the file we have to simply press the shortcut key as Ctrl+Alt+L to reformat the code in your file. With this key, the code in your file will be rearranged according to the code standards.
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With