Is it possible to achieve something like this:
I have one picture to set as a background on layout in which is also TextView. So I want that layout to set his height to wrap content (which should be the height of TextView) and ImageView to has fill_parent as height and width.
I tried using:
- LinearLayout with background and TextView
- TextView with background
- RelativeLayout with ImageView (set height to fill_parent) and TextView (set to wrap_content)
Is there a way to do this?
Sorry, if it’s next question about the same, but I have no idea how to find a solution.
EDIT:
I’ll try to be more specific. I want a TextView with background. But I want that background to be scaled to fit TextView which should be wrap_content width and wrap_content height. But I have image in higher resolution so there is a lot of unused space (background doesn’t scale).
No, there is no way to set a view’s width/height to both
wrap_contentandfill_parentsimultaneously.What exactly are you trying to achieve? Is this what you mean?
EDIT
If you want to nicely scale a background image for a
TextView, I think what you might want to look into is a 9-patch image. See this post for more info. Also this.