Text should be entered to the right of ImageView in EditText. If it suddenly turns out that the text filled the entire space to the right of the ImageView, it is necessary that the text continue to be entered under the ImageView starting from the (left) edge of the device screen. This is schematically shown in the attached figure. example

I must say that this version works wonderfully with TextView, but does not want to cooperate with EditText. Please do not remain indifferent and suggest at least the direction of solving my problem.

  • The question is interesting, but what you want to do without complex crutches will not work. If this is not very significant, it is easier to use one EditText immediately below or next to the picture. Also, of course, it is interesting to see an example of the implementation of such a flow around :) - Daniel Shatz
  • And what is the expression that this option does not want to cooperate with TextView? EditText is actually TextView's heir and there is not much change in it ... - Shutko Alexander

1 answer 1

After several experiments and studying EditText / TextView, it turned out that the TextView (in which everything necessary for editing the text is specified) has errors (or deficiencies) due to which it does not take into account the text span when drawing the cursor and selecting.

As a result, the text in the EditText when using LeadingMarginSpan is drawn correctly, and the selection and the cursor behave as if the text occupies a rectangle (with the exception of the first line).

To do this, you need to make your custom TextView and edit the bugs in it to finish the shortcomings. Given that TextView contains about 10,000 lines of code, this will not be easy.