1

I want to

  • use a TextView (or similar) to show dynamic text inside of a free-form shape (as shown below)
  • enable the user to change the text
  • render the result into a Bitmap

enter image description here

It's a relative easy task on iOS but it seems nobody did this on Android?! I hope someone has an idea how to solve it, can't find anything on the net...

Dirk
  • 2,011
  • 1
  • 20
  • 25
  • Must the user be able to edit directly in this shape? or can you open a dialog for that? – stoefln Sep 30 '14 at 23:09
  • Quite sure all you need is to set wrap_content for w & h and free-form is what you have. I think your question is the result of not knowing anything about android basics and thus can't find anything. If you want jagged edges though, that kind of free-form, idk - it never crossed my mind to do so. A jagged background image could do it perhaps stretching in height or width if needed. – CmosBattery Oct 01 '14 at 01:40
  • Hi @stoefln yes, the user should be able to edit the text directly. The idea is, to give the user a WYSIWYG feeling, it's much easier to use and feels more more natural in my eyes. – Dirk Oct 02 '14 at 20:38
  • @CmosBattery it seems you have a deeper understanding of the Android mechanics. I followed your advise but (may be I did it wrong) it doesn't work. I tried it with jagged background image with a transparent outside and a jagged colored area in the middle, and a background image with a filled area and a transparent inner area. I can't think of any other way of let the TextView now what shape my image has. Can you please share more details and a code example? Thank you! – Dirk Oct 02 '14 at 21:22
  • 1
    I don't think thats possible with standard android views. You might have to write your own WeirdShapeEditText view. – stoefln Oct 03 '14 at 14:10
  • Think I see you want the jagged edges to follow the text edges? Might be more time spent than its worth. I came up with cutting it all apart and using one line TextView surrounded by ImageViews per line. Weights all movement of jagged edges but it introduces other problems such as edges not matching. Static is simple here and dynamic is not. – CmosBattery Oct 03 '14 at 18:22
  • Or maybe something like this with Drawable might be the key: http://stackoverflow.com/questions/22042603/android-how-to-create-triangle-and-rectangle-shape-programatically – CmosBattery Oct 03 '14 at 18:31
  • I'm not actually going to write code or even play around with it in code as my interest does not go there. Another way might be to just make a static image as you have and say limit the number of char per individual one line TextView so they match the static image. Over top that an empty clickable EditText or whatever width and height matching all TextViews together with no shown text but when the user enters text its cut apart and placed correct into the individual TextViews at the right amount per line. I believe with some more ideas it could be made to "change" in size as well. – CmosBattery Oct 04 '14 at 00:50
  • Then it might be possible to change images and change size of individual lines as well according to the image in use making it appear dynamic if you really wanted. But man, that's a lot of work to do. Though, if your looking to learn, you'll learn a lot by doing it. There might still be some mistakes I made in saying all that but if you get the idea then its golden. – CmosBattery Oct 04 '14 at 00:52

0 Answers0