如何在Android Studio(2.1.1)中关闭Java中的自动缩进功能? (Windows 7的) [英] How to turn off auto-indenting in Java in Android Studio (2.1.1)? (Windows 7)

查看:222
本文介绍了如何在Android Studio(2.1.1)中关闭Java中的自动缩进功能? (Windows 7的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的一行包含8个空格(是,空格,不是制表符)和一些文本...

If I have a line with 8 spaces (yes, spaces, not tabs) and some text...

        x=3;

...,并且我的光标位于分号之后,当我按Enter时,它将光标置于x下方.换句话说,它缩进了8个位置.如果再按退格键,它将光标定位在分号之后!我希望退格键可以使我在新行上退回1个空格.

... 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.

Editor>代码样式> Java 中,标签大小= 1,缩进= 0,连续缩进= 0 . N.B.如果我尝试将Tab大小设置为0,则下次打开该对话框时为1,因此Android Studio显然不接受0,即使我在多个S.O中也看到了该建议.问题.

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.

编辑器>代码样式中,我未选中检测并使用现有文件缩进进行编辑,现在,如果我在分号后用Enter按下Enter,它将光标定位在4个空格处在右边,换句话说,它仍然缩进,只是没有那么多.

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,在进行了这些设置之后,我做了 File> Invalidate Caches/Restart .

N.B, that after making these settings I did a File > Invalidate Caches / Restart.

我不希望任何自动缩进.当我按下Enter键时,我希望它将光标定位在新行的第一个位置,而当我按下Backspace键时,我希望它返回1位,就像普通的哑巴"编辑器一样.如何关闭Android Studio中的所有自动缩进功能?

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?

推荐答案

Android Studio像大多数IDE一样,尽其所能来帮助您组织工作并使其成功.这是正常现象,但是当然可以禁用它.

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.

注意:禁用此项目时,您的项目可能会很混乱,如果您要缩进一段代码,请突出显示该代码,然后按CTRL+ALT+L,这将为您缩进突出显示的代码.

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.

因此,要禁用它,请按CTRL+ALT+S,这将打开设置.现在,转到左侧的编辑器"选项卡,然后转到常规",然后是智能键".您应该看到一个退格"部分.在那边,将有一个下拉菜单,单击该菜单,然后选择已禁用"选项. (Settings> Editor> General> Smart Keys>)

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> )

这篇关于如何在Android Studio(2.1.1)中关闭Java中的自动缩进功能? (Windows 7的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆