I have a PNG being used for a TextView background. The TextView is set
to wrap_content for width/height. The problem is, I cannot get it to
be smaller than the original pixel dimensions of the background PNG,
this leaves my text floating in the middle, as if I've used padding.

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:maxWidth="250dip"
        android:minWidth="150dip"
        android:text="Sample text"
        android:background="@drawable/my_png"
        android:gravity="center_vertical"
/>

It turns out that if I make the PNG into a nine-patch, the TextView
behaves as I expect, and the width/height of the TextView is then
allowed to be smaller than the physical dimensions of the background
PNG being used. So this is a workaround for now.

Does anyone know whether I should report this as a bug (targetting
1.6)? Or is the background drawable supposed to be taken into account
as part of the content width/height unless using a nine-patch?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to