64

This question already has an answer here:

I'm posting a quick reference for "How can I show line numbers in Android Studio?" See answer below.

NOTE: This question has been marked as a duplicate because Android Studio is based on IntelliJ. In future, if you have a similar question, it's probably worth looking for the IntelliJ setting.


  • This would be better if you didn't mention the howto video maybe, just wastes future peoples time... - DrCord
  • Good point @DrCord. Now revised. - HockeyJ
  • @Sumurai8. As an Android newbie, I had forgotten Android Studio is based on IntelliJ. I didn't think to look for IntelliJ settings and googled for Android studio. Very little was returned. I will keep the post here to help other newbies and have updated the question with a note to point others in the right direction for similar queries. Thanks - HockeyJ

3 답변


193

In Windows

1.Press Ctrl+Shift+A

enter image description here 2.Input following string: "show line numbers"

enter image description here And you will see the setting, this method can find all the settings easily!

MAC

1.Press Command+Shift+A 2.Input following string: "show line numbers"

and following same flow of android studio.


  • Despite answering my own question, marking this as the answer as it's the fastest way to get the right result. - HockeyJ
  • I have found that, after doing this, my line numbers get turned off again. There is a permanent solution here: stackoverflow.com/a/912112/1617737 . - ban-geoengineering
  • it works in linux version also - Anagh Hegde
  • It think by default after installing Android Studio, line numbers should be shown. - Jaime Montoya

40

It's simple. Just Right click in left side of Workspace area and choose Show line number.

enter image description here


  • This shows the line numbers. But only for the current file. If you need to show it to all files, then you should use @HockeyJ's solution below! - Ruchira Randana

37

  1. Go to File > Settings
  2. In the dialog, select 'Editor', then the sub-option for 'General', and then the sub-option for 'Appearance'.
  3. Select 'Show line numbers' as shown below.
  4. Click Ok.

enter image description here

Source

UPDATE The location for this setting has been changed to Editor -> General -> Appearance.


  • Really makes you wonder why this isn't enabled by default... - rob
  • I think from v2.3. This is the default behaviour. @RobertOliveira - Rishabh876

Linked


Related

Latest