Possible Duplicate:
Why does the background of TextView change it's size?
I have a TextView where I’ll put text dynamically and it has a background (custom bitmap, not plain color or gradient). I want the TextView (and the background, of course) wrap around the contained text (wrap_content). How can I do it?
See also Why does the background of TextView change it's size? .
The only thing I have found is to make the background bitmap very small, then it will stretch and wrap. But this will be not good quality…
If you place background image of fixed size then your view will take it’s size, so you need to use background which has no size so that it can take size of your text. To achieve this, you can do following 2 things:
1. Get the image of 1 pixel.
2. Draw the gradient image:
Note: For detail description follow the link.
EDITED:
3. If the image is not plain or gradient then you need to set the width of the textview programmatically each time you set the text.