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.

Spidey
  • 894
  • 1
  • 13
  • 29
AK824
  • 217
  • 3
  • 10

2 Answers2

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.

Konrad Krakowiak
  • 12,285
  • 11
  • 58
  • 45
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.

Prerna Jain
  • 1,240
  • 2
  • 16
  • 34
Surendar D
  • 5,554
  • 4
  • 36
  • 38