Saturday, February 26, 2011

[android-developers] bitmap drawable resource gravity ignored in layer list?

I'm trying to build a seek bar with text in/"under" it to make
something akin to the "slide to unlock" bar on the iPhone. I figured
I'd change the style of the seek bar and added:
<layer-list>
...
<item android:id="@android:id/background">
<layer-list>
<item>
<shape>
<corners android:radius="10dip" />
<gradient
android:startColor="#88747674"
android:centerColor="#885a5d5a"
android:centerY="0.25"
android:endColor="#889d9e9d"
android:angle="270"
/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/slide_to_finish_label"
android:gravity="fill_horizontal"/>
</item>
</layer-list>
</item>
...
</layer-list>

slide_to_finish_label is a 9-patch PNG. The default tile mode is
listed as none. When I use this nested layer-list as the background
of my app it works as I expect. My bitmap shows up stretched side to
side but not up and down. When I use this as the style for the seek
bar the bitmap shows up not stretched and repeating.

Changing the gravity attribute has no affect on the repeating. I
thought it might have something to do with the nesting of the layer
list, like that the item in the parent-list is being repeated. The
guide on Drawable Resources seemingly warns on this issue and suggests
using a bitmap to control stretching and repeating but even when I
reduce the item to just a bitmap (not a nested layer-list) gravity
still has no affect.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate