0

I am trying to make a sentence-filling like interface, where I can have TextViews and EditTexts mixed arbitrarily in a paragraph.

I have had a look at this question, but the problem was that when I have [ TextView1, EditText, TextView2 ] and the content of TextView1 consumes 1 full line and 1 fifth of the second line, then TextView1 will have to span the entire width because it is a rectangle. This pushes EditText to the next line, which is ugly.

So is it possible to create such kind of ViewGroup/Layout from existing stuff in Android, or I'd have to make a custom View from scratch?

In case I'm too bad at explaining, this screenshot describes my problem:

enter image description here

Thank you very much.

Community
  • 1
  • 1
Phil
  • 5,595
  • 5
  • 35
  • 55

1 Answers1

0

I think there's some work here :)

You should make two text views - one for line 1, one for line 2. Estimate the text, that fits on the first line, put it in the first text view. Put the rest in the second line, and it'll fit just nice.... I think you know this, and I doubt there is an easier way to do this :)

It's a nice task anyway.

Greets, Danail

Danail
  • 10,443
  • 12
  • 54
  • 76