2

I'm writing a text editor similar to QuickEdit and Turbo Editor.

However, I faced the problem that when my EditText deals with a large amount of code lines, it becomes slower and lagging.

From this question I found out that in my case I should create a custom EditText, then from this and this I suggested that I should override onDraw() and onMeasure() methods in it, but I didn't understand how I can apply this to EditText, and not to TextView.

Reading the sources also didn't give me the answer: I didn't find lines that possibly could improve performance of custom EditText.

Long story short: I'm looking for a way and detailed explanations on how to optimize EditText for a large amount of code lines (10 000 <).

Sinomine
  • 21
  • 1
  • The issue is still pending. I faced the same problem. But one thing I'm surprised of is anWrite apk is faster even for huge amounts yet very small in size! – Francis Nduba Numbi May 17 '18 at 22:38

1 Answers1

0

You could try to implement a custom view which is a RecyclerView. Each line is a new single EditText. I don't know how well the performance is. But you could give it a try.

Another tip is don't wrap the EditText inside a RelativeLayout. Use LinearLayout instead. A fixed width on the EditText will give also a performance boost. It prevents re-calculation and re-drawing of layout.

beeb
  • 1,583
  • 1
  • 10
  • 23