Android Studio禁用换行

时间:2014-01-02 11:35:22

标签: android android-studio

我在Android Studio上有这个奇怪的换行符,我想要禁用,因为它吓坏了我......

enter image description here

11 个答案:

答案 0 :(得分:52)

它也可以在上下文菜单下找到 enter image description here

答案 1 :(得分:50)

在Android Studio 0.4.0中,应该有所帮助:

Configure > Settings > Editor > Uncheck 'Use soft wraps in editor'

Screenshot from Android Studio 0.4.0 Settings screen

在Mac上(Android Studio 3.0):

Preferences -> Editor -> General -> Uncheck 'Use soft wraps in editor'

答案 2 :(得分:9)

我想完全禁用包装,我找到了解决方法。

enter image description here

它似乎不适用于特定的文件扩展名(Groovy,HTML,Java等),但具有一般价值。我设置了一个非常大的数字,我没有更多的包装。

我认为他们应该为它提供一个主选项!

答案 3 :(得分:5)

在Android Studio 1.0.2中,没有名为配置的菜单。 设置现在位于文件菜单下。一切都是公认的答案。

答案 4 :(得分:2)

在Android Studio 2.3.3+中,要禁用换行,您需要转到:

    • 代码样式
      • [选择一种语言,例如爪哇]
      • 设置" 打包"没有。

enter image description here

答案 5 :(得分:2)

右键单击行号附近的自动换行选项。

enter image description here

答案 6 :(得分:1)

在Android Studio 3.5.3中,您可以设置保鲜膜以与原始行缩进对齐,并设置其他缩进空间。使我更容易阅读 设置->编辑器->常规

settings screenshot

答案 7 :(得分:1)

如果您想知道如何针对Flutter / Dart执行此操作,请按以下步骤操作:

  1. 文件->设置->代码样式->飞镖
  2. 将“线长”字段更改为大于默认值的字段(我使用的是300)

enter image description here

这适用于任何编程语言。

答案 8 :(得分:0)

我发现有帮助,在当前版本(Android Studio 3.2)中,您可以将自动换行指示器设置为仅在当前行中显示,此外还可以在编辑器中使用自动换行。

在以下位置检查仅显示当前行的软包装指示符

Editor -> General -> Soft Wraps

enter image description here

答案 9 :(得分:0)

Android Studio 4.1.3:

首选项 > 代码样式 > 取消选中 import UIKit class ViewController: UIViewController { @IBOutlet weak var helloButton: UIButton! @IBAction func showAlert(_ sender: Any) { //var alert = UIAlertController(title: "Hello!", message: "Hello, world!",preferredStyle: UIAlertControllerStyle.Alert) let alert = UIAlertController(title: "Hello", message: "Hello, world", preferredStyle: UIAlertController.Style.alert) alert.addAction(UIAlertAction(title: "close", style: UIAlertAction.Style.default, handler: nil)) self.present(alert,animated:true,completion:nil) // ❌ it didn't work self.helloButton.setTitle("Clicked",for:.normal) } override func viewDidLoad() { super.viewDidLoad() } }

答案 10 :(得分:-1)

还有自动换行问题,AS会自动在长行中添加硬行返回。我在[偏好设置]> [编辑器]> [代码样式]> [X]时用硬包装,在键入时用[]换行找到了该设置。