Changing the Style of Braces in Android Studio

AndroidAndroid Studio

Android Problem Overview


I recently started to use Android Studio. It uses this style of braces by default:

public void scanFile(String filePath) {

}

The code I need to submit requires to be styled as follows:

public void scanFile(String filePath) 
{

}

Where can I find a setting for this?

Android Solutions


Solution 1 - Android

You need to change the code style in Project Settings

File -> Settings -> (Project Settings) -> Code Style -> Java -> Wrapping and Brances

Change the Braces Placement for Class and Method declaration to Next Line

(Or, on a Mac, do the same thing in Preferences)

enter image description here

Solution 2 - Android

This one worked for me in Android Studio 3.0 Beta 7

change braces placement in Android Studio 3

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3081519View Question on Stackoverflow
Solution 1 - AndroidLibinView Answer on Stackoverflow
Solution 2 - AndroidYasser JaroufView Answer on Stackoverflow