Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robojuice / Butterknife @InjectView AutoFormatting issue in Android Studio

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.

like image 569
AK824 Avatar asked Mar 06 '15 19:03

AK824


2 Answers

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.

like image 80
Konrad Krakowiak Avatar answered Sep 21 '22 05:09

Konrad Krakowiak


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.

like image 29
Surendar D Avatar answered Sep 22 '22 05:09

Surendar D