Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - change default code style

I'm used to write code in a such way:

private String blabla()
{
    return "bla";
}

But Android Studio is adjusted for this code:

private String blabla() {
    return "bla";
    }

Question: how can I change this option for me?

like image 792
toto Avatar asked Oct 24 '15 15:10

toto


People also ask

How to change code style Android Studio?

The path is: File > Settings (Ctrl + Alt + S) > Editor > Code Style > Java. Then select your relevant tab.

How do I add code style XML in IntelliJ?

Out of the box, IntelliJ IDEA allows you to import settings in the IntelliJ IDEA code style XML or Eclipse XML Profile format. Press Ctrl+Alt+S to open the IDE settings and select Editor | Code Style. and select Import Scheme. Then select the necessary format.

What is code style in IntelliJ?

Code style scheme settings are automatically applied every time IntelliJ IDEA generates, refactors, or reformats your code. The IDE comes with two pre-defined schemes: the Project scheme and the Default scheme. In the Project scheme, the settings that you configure apply only to your current project.

How do I enable code formatting in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Tools | Actions on Save. Enable the Reformat code option.


1 Answers

Go to File -> Settings.

Then in dialog, Editor -> Code Style -> Java -> Wrapping and Braces tab, then you can adjust braces placement

Remember to "Apply" your changes.

like image 92
Murat Mustafin Avatar answered Oct 13 '22 11:10

Murat Mustafin