I want to customize EditText's behavior like HandRite.
So I tried examing EditText's editing performance when there are many ImageSpan, but it was too slow when adding or deleting character on middle using touch screen and IME after below code.
How can I speed up this performance?
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 1000; i++) {
sb.append(' ');
}
SpannableString ss = new SpannableString(sb.toString());
Random random = new Random();
for (int i = 0; i < 1000; i++) {
Drawable d = new ColorDrawable(random.nextInt());
d.setBounds(0, 0, mEditText.getLineHeight(), mEditText.getLineHeight());
ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
ss.setSpan(span, i, i+1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
mEditText.setText(ss);