The images are just stored as compressed PNGs, so the overhead for having
theme separate is the normal PNG overhead.  Whether one way or the other
will be a win depends on how much they compress in the two different
configurations (which depends on the contents of the images) as well as the
overhead per image.

It shouldn't be too hard to implement your own SpriteDrawable if that is
what you want.  Take a look at the BitmapDrawable code as a place to start.

On Wed, Feb 18, 2009 at 3:30 PM, Noonien Soong
<[email protected]>wrote:

>
> What is the best way to store/load/handle a lot of Drawables for my
> application?
>
> Let me explain....
>
> - Let's say I need to display a lot of small avatar images in my
> application
> - Let"s say each avatar image has a size of 40x40 and I need to
> display 32 different sprites. Not all at the same time, but I might
> have to display 10 of them on the screen at the same time. In addition
> I need to draw them on a canvas were they walk around or something...
>
> My reflex would be to create one PNG with 4x8=32 tiles (size :
> 320x160).
> For drawing the sprites on my canvas I would allocate a bitmap for
> each sprite, load it and then and draw it when I need to (case #1)
> However, I also need to display the avatars in other views, e.g. in a
> ListView in a different activity (case #2).
>
> For #2, it would be very convenient if I could have them as Drawables.
> So should I just have 32 pngs in my res/drawable directory ?
>
> I feel like it would be great to have something like a SpriteDrawable
> where I could specify in an xml file which part of a bigger bitmap I
> want to use as a drawable on its own.
>
> Or is it totally fine to have A LOT of small PNGs in my res/drawable
> folder ? Does the packaging process optimize them anyways?
>
> Would be great to get some input on these thoughts... Any comments
> appreciated.
>
>
>
>
>
>
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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

Reply via email to