ImageView does not create a 100x100 Bitmap in this case, the memory
usage cost will be 50x50xbit depth of your original Bitmap. This
behavior is the same for View's background property. Note that
stretching Bitmaps at runtime is very expensive when hardware
acceleration is off.

On Wed, Jan 18, 2012 at 5:43 AM, Dusk Jockeys Android Apps
<duskjock...@gmail.com> wrote:
> This is a a backend SDK framework question.
>
> Say I have an ImageView that is set to, say, 100*100px, and I set it
> to show a 50 * 50px  Bitmap which I have first loaded, so that it
> stretches the bitmap to fit its larger size. (Note I mean px rather
> than dip, I am trying to keep things simple to help my understanding)
>
> How does the ImageView treat the bitmap in the background in terms of
> memory usage, does it still have to effectively internally create a
> 100*100 one for display, or does it use the 50*50 one and stretch it
> at display time?
>
> Is the behaviour the same for background images on other types of
> views?
>
> I am trying to avoid Dalvik Out Of Memory errors so I am wondering
> whether it is worth using smaller bitmap sizes for my resources and
> stretching them to fit the views, or whether it is the final size of
> the view which determines the amount of bitmap memory used at run
> time.
>
> Is there a difference in behaviour between this on 2.x and 3.x and
> 4.x?
>
> Regards
> James
>
> --
> 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



-- 
Romain Guy
Android framework engineer
romain...@android.com

-- 
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