Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No line numbers in Eclipse or Android Studio XML editor

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.

like image 253
MR Mido Avatar asked Apr 27 '11 00:04

MR Mido


People also ask

How do I show line numbers in XML?

If you view source in chrome, it will show line numbers (assuming your source XML file is separated into different lines). "View page source" on Mozilla Firefox also displays the XML document, with numbered lins.

Why my XML is not opening in Android Studio?

Go to plugins -> Android support and disable this. Restart Android studio and enable the plugin again. Worked for me.

Does Android Studio uses XML?

Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts. You can also use Android Studio's Layout Editor to build your XML layout using a drag-and-drop interface. Instantiate layout elements at runtime.

Where is the XML file in Android Studio?

Location in Android Studio: You will find out this file inside the res folder and inside it there is another folder named layout where you will get all the layout files for their respective activities or fragments.


2 Answers

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.

like image 150
owen gerig Avatar answered Oct 11 '22 08:10

owen gerig


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+ enter image description here

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

like image 39
whyoz Avatar answered Oct 11 '22 10:10

whyoz