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_
To make the line numbers always show for 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.