Android studio 防止代码在粘贴时重新格式化 [英] Android studio prevent code reformatting on paste

查看:61
本文介绍了Android studio 防止代码在粘贴时重新格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用 Android Studio(取代 Eclipse),但我不习惯的一件事是 Studio 如何自动(在某些情况下)重新格式化当前文件中的部分甚至全部代码.其中一种情况是将文本粘贴到我的文件中.当我这样做时,整个块会根据我可以在设置"中格式化(但严重不喜欢)的神秘规则重新格式化.

I've started using Android Studio (replacing Eclipse) and one thing I just can't get used to is how Studio automatically (under certain circumstances) reformats some or even all of my code in the current file. One of those circumstances is pasting text into my file. when I do that, the entire block gets reformatted according to the arcane rules I can format (but seriously do not like) in the Settings.

设置中是否有一个复选框可以关闭此功能??

Is there a check box somewhere in the settings that turns this off??

我可以很容易地格式化我自己的代码,而且由于我还可以手动告诉 Studio立即执行",似乎没有任何理由忍受所有的自动手动操作.

I can format my own code easily enough, and since I can also manually tell Studio to "do it now", there doesn't seem to be any reason to put up with all the automatic hand-holding.

推荐答案

您可以通过将粘贴时重新格式化选项设置为无到来停止它.您可以在 Editor -> General -> Smart Keys 下找到该选项.看图

You can stop it by setting the Reformat on paste option to none to None. You can find the option under Editor -> General -> Smart Keys. See the image

您可以通过按Ctrl + Alt + Shift + V

或者,您可以右键单击要粘贴代码的位置,然后单击简单粘贴

Alternatly you can right click on where you want to paste the code and then click Paste simple

这篇关于Android studio 防止代码在粘贴时重新格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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