0

I am developing and Android app that has a "fill in the blanks" activity. For that matter, I wish to have a TextView followed by an EditText followed by another TextView, to show something like:

Lorem ipsum dolor sit amet, consectetur ________ elit. Aliquam quis est ex. In maximus consectetur tortor, quis lacinia risus _______ eu. Etiam purus nulla, tincidunt ac mattis sit amet, lobortis non orci.

However, I'm unable to concatenate EditText at the end of a multi-line TextView, since the second line's width takes up the whole screen.

Does anyone have a suggestion on how to implement such feature?

A couple of workarounds that I though as plan B would be to have a multiline EditText where I programmatically prevent touches outside the area I want to edit or to have the "fill in the blank" indicated in the main text but a separate input to actually insert the text. But none of these actually please me.

Can anyone help with the original solution?

Pankaj Lilan
  • 4,245
  • 1
  • 29
  • 48
filipebarretto
  • 1,842
  • 1
  • 13
  • 27
  • are you creating a separate layout for each text? – pablobu Jul 03 '17 at 21:50
  • @pablobu as of now, I have one TextView and on EditText inside a RelativeLayout, but can't position the elements like i wish. – filipebarretto Jul 03 '17 at 21:56
  • I think it can't be done with EditText and TextView. Maybe you can try to use a TextView with ClickableSpan on your blanks and when those are tapped open a dialog to enter the word and then update your TextView with the completed word. – pablobu Jul 03 '17 at 22:56
  • I think your real question is "How do I create a layout for the desired UI?". I don't know the answer, but I think you are hung up on your proposed solution involving mixing TextView and EditText. It will help a lot if you ask the right question. – Code-Apprentice Jul 04 '17 at 00:21

1 Answers1

0

Not quite a duplicated question, but have a read through this guys answer.

It may help you out

How to set the part of the text view is clickable

Vaughan D
  • 149
  • 1
  • 1
  • 15