Formatting @BindView code
Asked Answered
D

1

8

Android Studio by default format Butterknife code in this way:

@BindView(R.id.text_view) 
TextView mTextView

Is there a way to tell Android Studio to format code in one line, like this:

@BindView(R.id.text_view) TextView mTextView

If this is possible I would like this rule to apply only to @BindView annotation.

Dariodariole answered 9/6, 2017 at 11:57 Comment(0)
G
14

in Android Studio 2.3.3 File -> Settings -> Editor ->Code Style -> Java -> Wrapping and Braces -> Field annotations -> set to "Do not Wrap"

but this will prevent AS to put the new line on all field annotations.

i don't know if it is possible to have this option only for @BindView, however, if you set the option like this, AS will not put all annotations inline. for instance if you have

@Nullable
String foo;

@BindView View bar;

and format the code, AS will leave both annotations as they are.

Guerrilla answered 9/6, 2017 at 12:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.