Android studio format code won’t auto break line

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)