7

I am trying to fix a tab/indent issue with Android Studio.

It is not setting the proper spacing (4) on new lines.

I tried setting the tab, indent, and continuation size to 4 but nothing changes.

enter image description here

Even setting crazy values has no effect

enter image description here

Do you know why I cannot get the spacing to be 4 instead of the 2 it's stuck at?

Aggressor
  • 13,323
  • 24
  • 103
  • 182
  • Comparing your values with mine, I can see that every checkbox is unchecked, and I have 4-4-8 as the values for Tab size, indent, continuation indent, respectively. Those were the default values, by the way, and they're working properly. Can you try to mimic my combination and uncheck the checkboxes? – Vucko Jul 13 '16 at 17:57
  • Yes but when I use the default, new lines are still only indented by 2. Nothing is changing the new line indents. – Aggressor Jul 13 '16 at 17:59
  • i.e. `public int[] X = new int[]{1, 3, 5, 7, 9, 11};` is always indented by 2 `..` no matter what changes which is making no sense to me. – Aggressor Jul 13 '16 at 17:59
  • Bloody hell, that does not make any sense. Try to restart Android studio (the famous "did you try turning it off and back on") :D – Vucko Jul 13 '16 at 18:03
  • I'm more curious if you can make changes to yours and see a difference. If you change the tab level do the methods and new lines move forward by that amount? – Aggressor Jul 13 '16 at 18:06
  • Interestingly enough, I cannot seem to "break" mine. I've set the tab size to 58, and when I click TAB, it moves 4 places. I set the Indent to 20, and I got a tiny message at the top of the file "This file is indented 4 spaces instead of 20" Allowing me to say "Ok" and "Indent with 20". – Vucko Jul 13 '16 at 18:10
  • Hmm I don't get that message and this is a freshly installed version. Interesting...Are you on the Window client too or the OS one? – Aggressor Jul 13 '16 at 18:12
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/117245/discussion-between-vucko-and-aggressor). – Vucko Jul 13 '16 at 18:14

1 Answers1

9

Go to Settings -> Editor -> Code Style and unmark the checkbox "Enable EditorConfig support".

enter image description here

  • 3
    In my case it was actually a setting immediately above this one: **Detect and use existing file indents for editing**. It's not visible in your screenshot, so presumably something that was introduced in a later version. (I'm currently on AS 4.0.2) – MH. Oct 12 '20 at 10:54