How to overlay EditText on TextView just after the end of text
I am trying to create a paragraph of text using TextView and need to insert EditText in between text like fill in the blanks. Is it possible to build custom view like that ? As I am new in this forum I could post any image. It should look somewhat like below:
World is a common name for the whole of human [EDIT TEXT], specifically human experience, history, or the human condition in general, worldwide, i.e. anywhere on Earth.
In a [EDIT TEXT] context it may refer to: (1) the whole of the physical Universe, or (2) an ontological world (see world disclosure). In a [EDIT TEXT] context, world usually refers to the material or the profane sphere, as opposed to the celestial, spiritual, transcendent or sacred. The "end of the world" refers to scenarios of the final end of human history, often in religious contexts.
ok. Now I can post images :-) In the image below, red colored cells are edit texts. Other colored texts are textviews (sorry too much bright colors). Now, if I use leftOf/rightOf methods in RelativeLayout it will look like the second image. Am I thinking in the wrong direction ?
i think the best way would be to create your own editText view . however, this is probably a very hard thing to do.
if you are short in time , you can use HTML and use a webView to show the content . i'm pretty sure that in html this task is much easier , as it's already implemented in many places.
It doesn't seem like there is an easy way to do this without making your own layout manager. See this post for a line-breaking widget layout implementation. You can also achieve something similar by using Romain Guy's FlowLayout implementation.
I've never used either of these implementations before to achieve the "fill-in-the-blank" effect you described, but it seems to me that you would need to add the TextView and EditText objects via the layout's addView method. You might have to experiment a little to get it working correctly, but I think this should help you get on the right track.