Eclipse 或 Android Studio XML 编辑器中没有行号
在 Eclipse 编辑器中编辑 XML 文件时,不显示行号。
用例:
我创建一个包含许多视图的布局,其中一个缺少 android:layout_width 属性。当二进制 XML 布局资源膨胀时,这会导致运行时错误。错误日志告诉我检查 XML 文件中的 361 之类的内容。
由于显示了行号,我可以找到有问题的行并进行更改,而无需在另一个编辑器中打开文件。
When editing XML files in the editor for Eclipse, line numbers are not displayed.
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
尝试右键单击灰色条并选择显示行号
它对我有用,希望对你也有用
或更改设置
文件>设置>编辑>然后单击出现的“显示行号”框。
try right clicking the grey bar and selecting show line numbers
it works for me so hopefully it will for u too
or change it in the settings
File > Settings > Editor > Appearance then click the "Show line numbers" box.
如果您使用的是 Android Studio,您可以通过转到
File > > 显示行号。设置>编辑>一般>外观
,然后选中“显示行号”框。更新: Android Studio v1.5+
1) 在编辑器内单击,Command + Shift + A,然后键入“显示行号”
2) 选择“首选项”中的第二个选项,它将带您进入屏幕过去普遍存在的>外观
3) 勾选“显示行号”框
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.UPDATE: Android Studio v1.5+
1) Click inside the editor, Command + Shift + A, and type "show line numbers"
2) Select the second option in Preferences and it will take you to the screen that used to exist in General > Appearance
3) Check the "Show Line Numbers" box
文件>设置>编辑>然后单击出现的“显示行号”框。
File > Settings > Editor > Appearance then click the "Show line numbers" box.
在 Eclipse 中: Windows >首选项>一般>编辑>文本编辑器
检查:“显示行号”
默认情况下不选中它。它适用于源代码和 xml 文件(至少在 helios 中)
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)
要使 Android Studio 始终显示行号:
接受的答案有效,但它只会使行号在活动编辑器上可见。
To make the line numbers always show for Android Studio:
The accepted answer works, but it will only make the line numbers visible on the active editor.
在 OS X 上:Android Studio(屏幕左上方)>首选项>编辑>外貌。
On OS X: Android Studio (top left of the screen) > Preferences > Editor > Appearance.
2013 年 12 月:从 Eclipse 4.4 开始,您无需寻找查看行号的选项,因为它们默认情况下可见。
关于 Android Studio,这是另一个故事:自 2013 年 5 月起,Android Studio 0.3.x+ 是 基于 IntelliJ IDEA。
请参阅“如何在 IntelliJ 中永久拥有行号?”。
拉尔斯·沃格尔只是发表在他的博客:
开始,Eclipse SDK Luna (4.4) 中的行号是默认的
从今天(2013 年 12 月 10 日)
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.
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?".
Lars Vogel just published on his blog:
Line numbers are default in Eclipse SDK Luna (4.4) as of today
(December 10, 2013)
我知道这是一个老问题,但我刚刚遇到这个问题,所以我必须为自己找到解决方案。我认为根据我之前阅读的答案,菜单已经发生了一些变化。以下是如何在 MAC 上的 Android Studio 1.5 上执行此操作。
您首先单击要查看数字的窗口“编辑器”,然后只需选择下面两个建议的解决方案之一。
最简单的方法就是右键单击灰色栏,如 owen-gerig 显示,我认为这是最简单的,但如果你想通过菜单设置它,你可以通过 View ->;活动编辑器 ->显示行号。希望这有帮助。
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.
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-gerig shows, 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.
要使行号始终显示在您的 Android Studio 中,请按照此操作,转到:
文件>设置>编辑>一般>外观,然后选中“显示行号”框,特别是如果您使用的是 AS 2.1.1。如下图...如何在 Android Studio 2.1.1 中显示行号
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