K
K
kirvel2020-06-14 20:05:39
Android
kirvel, 2020-06-14 20:05:39

Align only new text entered in EditText, ignoring old one?

I have the following code:

if(position == 1) {
      editText.setGravity(Gravity.CENTER);
      editText.append("\n");
} else  {
    editText.setGravity(Gravity.START);
    editText.append("\n");
}

If position = 1, then ALL text is centered (and to the beginning of the line if position != 1). But I need to align only the newly entered text, ignoring the previously written one. How can I implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
yoloroy, 2020-06-15
@yoloroy

You can display the input text in the FlowTextView , and use the old text as an object for wrapping (mb instead of gravity text, gravity view will be used)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question