Robojuice / Butterknife @InjectView AutoFormatting issue in Android Studio
Asked Answered
D

2

12

I am adopting the @InjectView theme throughout my project and have a minor issue when it comes to condensing these declarations. After I put in the initial code it looks great in one line like this..

@InjectView(R.id.tv_report_summary_name) TextView tvReportSummaryName;

However if I do an auto format (Ctrl + Shift + F), Android Studio is automatically replacing this with two lines so it looks like:

@InjectView(R.id.tv_report_summary_name)                                     
TextView tvReportSummaryName;

Is there a way to avoid this or modify my formatting options to make this not happen? Any help is greatly appreciated.

Doggery answered 6/3, 2015 at 19:23 Comment(0)
F
36

When you open Preferences -> Code Style -> Java.

Choose Tab Wrapping and Braces.

After that scroll to bottom and there is option to set this style as is shown in the image below:

enter image description here

Choose which is wright for you.

Foxhound answered 6/3, 2015 at 19:54 Comment(1)
I am glad that I could help youFoxhound
L
4

Follow this :

File -> Settings -> Editor -> Code style -> Java -> Wrapping and Braces -- Field Annotation and select the checkbox (Do not wrap after single annotation)

Hopefully, it will solve your problem.

Lemkul answered 9/6, 2016 at 5:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.