Eclipse 或 Android Studio XML 编辑器中没有行号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5798009/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 14:40:50  来源:igfitidea点击:

No line numbers in Eclipse or Android Studio XML editor

xmleclipseandroid-studio

提问by MR Mido

When editing XML files in the editor for Eclipse, line numbers are not displayed.

在 Eclipse 编辑器中编辑 XML 文件时,不显示行号。

Use case:

用例:

I create a layout with many views, one of these lacks android:layout_width attribute. This causes a runtime error when the binary XML layout resource is inflated. The error log tells me to check like 361 in my XML file.

我创建了一个具有许多视图的布局,其中一个缺少 android:layout_width 属性。当二进制 XML 布局资源膨胀时,这会导致运行时错误。错误日志告诉我在我的 XML 文件中检查 361。

Thanks to the line number being displayed I can find the offending line and make the change without having to open the file in another editor.

由于显示了行号,我可以找到有问题的行并进行更改,而无需在另一个编辑器中打开文件。

回答by owen gerig

try right clicking the grey bar and selecting show line numbers it works for me so hopefully it will for u too

尝试右键单击灰色栏并选择显示行号它对我有用所以希望它也适合你

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

or change it in the settings

或在设置中更改它

File > Settings > Editor > Appearance then click the "Show line numbers" box.

文件 > 设置 > 编辑器 > 外观,然后单击“显示行号”框。

回答by whyoz

If you're using Android Studio, you can show the line numbers by going to File > Settings > Editor > General > Appearance, then check the "Show line numbers" box.

如果您使用的是 Android Studio,则可以通过转到 来File > Settings > Editor > General > Appearance显示行号,然后选中“显示行号”框。

UPDATE:Android Studio v1.5+ enter image description here

更新:Android Studio v1.5+ 在此处输入图片说明

1) Click inside the editor, Command + Shift + A, and type "show line numbers"

1) 在编辑器内单击,Command + Shift + A,然后键入“显示行号”

2) Select the second option in Preferences and it will take you to the screen that used to exist in General > Appearance

2)在首选项中选择第二个选项,它会带你到以前存在于常规>外观中的屏幕

3) Check the "Show Line Numbers" box

3) 勾选“显示行号”框

回答by Sonia John Kavery

File > Settings > Editor > Appearance then click the "Show line numbers" box.

文件 > 设置 > 编辑器 > 外观,然后单击“显示行号”框。

enter image description here

在此处输入图片说明

回答by John S.

In eclipse: Windows > Preferences > General > Editors > Text Editors check: "show line numbers" It is not checked by default. It is for both source code and xml files (at least in helios)

在 eclipse 中:Windows > Preferences > General > Editors > Text Editors check: "show line numbers" 默认不勾选。它适用于源代码和 xml 文件(至少在 helios 中)

回答by Hunter S

To make the line numbers always show for Android Studio:

要使行号始终为Android Studio显示:

File > Settings > Editor > Appearance then click the "Show line numbers" box.

文件 > 设置 > 编辑器 > 外观,然后单击“显示行号”框。

The accepted answer works, but it will only make the line numbers visible on the active editor.

接受的答案有效,但它只会使行号在活动编辑器上可见。

回答by Aqua

On OS X: Android Studio (top left of the screen) > Preferences > Editor > Appearance.

在 OS X 上:Android Studio(屏幕左上角)> Preferences > Editor > Appearance。

回答by Thanos

I know this is an old question but I just came across the problem so I had to find a solution for my self. I assume the menu has changed a bit based on the previous answers that I am reading. So here is how to do it on Android Studio 1.5 on MAC.

我知道这是一个老问题,但我刚刚遇到了这个问题,所以我不得不为自己找到解决方案。我认为根据我正在阅读的先前答案,菜单已经发生了一些变化。所以这里是如何在 MAC 上的 Android Studio 1.5 上做到这一点。

You first click on the window "editor" that you want to see the numbers and then simply choose one of the two proposed solutions under.

您首先单击要查看数字的窗口“编辑器”,然后只需选择下面的两个建议解决方案之一。

The easiest way is simply right click on the grey bar as owen-gerigshows, which I think is the easiest, but if you want to set it through the menu you can via View -> Active Editor -> Show Line Numbers. Hope this helps.

最简单的方法是在owen-gerig显示的灰色条上单击鼠标右键,我认为这是最简单的,但是如果您想通过菜单设置它,您可以通过 View -> Active Editor -> Show Line Numbers。希望这可以帮助。

Line Numbering on Android Studio 1.5 for MAC

Line Numbering on Android Studio 1.5 for MAC

回答by Ephraim Tarfa

To make the line numbers show always in your android studio, follow this, go to: File > Settings > Editor > General > Appearance and then check the "Show line numbers" box especially if you are using AS 2.1.1. Picture here below...How to show line numbers in Android Studio 2.1.1

要使行号始终显示在您的 android studio 中,请按照此操作,转到:文件 > 设置 > 编辑器 > 常规 > 外观,然后选中“显示行号”框,特别是如果您使用的是 AS 2.1.1。下图...如何在 Android Studio 2.1.1 中显示行号

回答by VonC

Dec 2013: Starting with Eclipse 4.4, you won't have to look for an option to see line numbers, because they will be visible by default.

2013 年 12 月:从 Eclipse 4.4 开始,您无需寻找查看行号的选项,因为默认情况下它们是可见的

Regarding Android Studio, this is another story: since May 2013, Android Studio 0.3.x+is based on IntelliJ IDEA.
See "How can I permanently have line numbers in IntelliJ?".

关于 Android Studio,这是另一个故事:自 2013 年 5 月以来,Android Studio 0.3.x+基于 IntelliJ IDEA 的
请参阅“如何在 IntelliJ 中永久拥有行号?”。



Lars Vogeljust published on his blog:

Lars Vogel刚刚在他的博客上发表了

Line numbers are default in Eclipse SDK Luna (4.4) as of today

截至今天,行号是 Eclipse SDK Luna (4.4) 中的默认值

(December 10, 2013)

(2013 年 12 月 10 日)

We conducted a user survey if users want to have line numbers activated in text editors in the Eclipse IDE by default.
The response was very clear:

如果用户希望在 Eclipse IDE 的文本编辑器中默认激活行号,我们进行了一项用户调查。
回应非常明确:

YES : 80.07% (1852 responses)
NO  : 19.93% (461 responses)
Total  : 2313
Skipped:   15

With Bug 421313, Review - Line number should be activated by default, we enabled it for the Eclipse SDK build, I assume other Eclipse packages will follow.

对于错误 421313默认情况下应激活 Review-Line 编号,我们为 Eclipse SDK 构建启用了它,我假设其他 Eclipse 包将跟随。