Android Question Add line number on Edittext

Hello,

I want to make a notebook that is something like an editor.

You must have seen in Android Studio or B4A itself that when we write our code and press Enter, a new line is added and the line number is displayed next to it, and if we delete a line in the middle, a number will be subtracted from the bottom lines very regularly! I want exactly the same thing.

Please help if possible, thank you
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
It depends on what you are trying to do.

If editing is not needed then you can use something like: https://www.b4x.com/android/forum/t...e-parser-b4x-code-highlighter.109308/#content
Based on your question, you do need to support editing. It will not be simple. You can put a tall EditText inside ScrollView next to a tall label. Update the label with the line numbers in the text changed event.
I will make a note app with b4a.
This is very good!
Thank you very much.
 
Upvote 0
It depends on what you are trying to do.

If editing is not needed then you can use something like: https://www.b4x.com/android/forum/t...e-parser-b4x-code-highlighter.109308/#content
Based on your question, you do need to support editing. It will not be simple. You can put a tall EditText inside ScrollView next to a tall label. Update the label with the line numbers in the text changed event.
Sorry I just reviewed the source and got the output and saw that it is a label and not a text editor.
I want something like this but it can be edited because my program will be a notebook.
please help. Thankful
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top