I have a custom view (extending RelativeLayout
) enable to display a text or/and an icon.
The problem is when I set wrap_content
for width
attribute, the view takes the whole size available and I want that my view takes only the place needed by the text or/and icon (of course when I set wrap_content
).
I think I have to override the onMeasure()
method but I don't really understand how do it works.
I have a look to the default TextView
onMeasure()
method but it is really huge !