If I have a line with 8 spaces (yes, spaces, not tabs) and some text...
x=3;
... and my cursor is placed after the semicolon, when I hit Enter it positions the cursor under the x. In other words it indents it 8 positions. If I then hit backspace it positions the cursor after the semicolon! I expect the backspace to take me back 1 space on the new line.
In Editor>Code Style > Java, Tab size = 1, Indent = 0, Continuation indent = 0. N.B. that if I try to set Tab size to 0 it's 1 next time I bring up that dialog, so 0 is apparently not acceptable to Android Studio, even though I see it suggested in several S.O. questions.
In Editor > Code Style I UNchecked Detect and use existing file indents for editing and now if I hit Enter with the cursor after the semicolon it positions the cursor 4 spaces in the from the right, in other words it still indents, just not as much.
N.B, that after making these settings I did a File > Invalidate Caches / Restart.
I don't want any automatic indenting. When I hit Enter I want it to position the cursor at the first position of the new line, and when I hit backspace I want it to go back 1 position, just like an ordinary "dumb" editor. How do I turn off all automatic indenting in Android Studio?
Change your default indenting for Java (not just on the general Code Style page). Go to File > Settings > Editor > Code Style > Java. On the Tabs and Indents tab click "Use tab character".
Indentation settings for Java Code style scheme settings are configured in Settings/Preferences | Editor | Code Style | Java. Use the tab or space character for indentation and code formatting.
Android studio tries its best, like most IDEs, to help you organize your work and make it successful. It is normal, but of course, there is a way to disable it.
Note: Your project can be really messy when disabling this, if you want to properly indent a block of code, highlight it then press CTRL+ALT+L
, this will indent the highlighted for you.
So, to disable it, press CTRL+ALT+S
, this will open settings. Now, go to the Editor tab at your left, where you then go to General, then Smart Keys. You should see a "Backspace" part. Over there, there will be a dropdown menu, click that then select the "Disabled" option. (Settings>Editor>General>Smart Keys> )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With