0

i'm looking to implement a gap text / cloze in android. Something like this:

Usually, elephants weigh ___ tons, which makes them one of heaviest mammals on earth after blue _______ (marine animals).

As long as everything is in one line, that's not to difficult to implement: A horizontal linear layout of multiple TextViews/EditTexts will work perfectly fine.

However, this approach reaches its limit with sentences/paragraphs so long that they span multiple lines. "Hardcoding" new lines isn't a solution either, as i'm targeting different screen sizes. Any simple ways to fix that?

My solution in the moment is using a vertical linear layout, but this results in wasted space & ugly (much to long) editTexts:

Usually, elephants weigh

________________________________________.

tons, which makes them one of heaviest mammals

on earth after blue

_________________________________________.

(marine animals).

m.reiter
  • 1,796
  • 2
  • 11
  • 31

1 Answers1

0

At first I tried a horizontal linear layout, where the children were both TextView and EditText widgets. However, as you've probably noticed, they don't wrap around.

If you don't mind external libraries, a possible solution is at https://stackoverflow.com/a/38190723/4979500

I haven't tried it, but it claims to be able to do a horizontal layout with wrap around.

El Stepherino
  • 600
  • 6
  • 18