Scale a background image or drawable?

by Sam » Thu, 10 Sep 2009 00:47:40 GMT

Sponsored Links

On a layout I want to scale the background image (keeping it's aspect
ratio) to the space allocated when the page gets created. Anyone have
any idea how to do this?

I am using layout.setBackgroundDrawable() and am using a
BitmapDrawable to setGravity for clipping and filling, but don't see
any option for scaling.


Scale a background image or drawable?

by Sam » Fri, 25 Sep 2009 10:37:45 GMT

 Thanks! It worked great with some tweaking for what I needed.

> Drawable:

Sponsored Links

Scale a background image or drawable?

by Sam » Fri, 25 Sep 2009 10:38:01 GMT

 Thanks! It worked great for what I needed to do.

> Drawable:

Other Threads

1. Problem with invalidate

If I have two views in a linear layout, and invalidate one of them, it
causes the other view to redraw needlessly. Im my application on view
is animated, and the other takes a long time to draw, this is causing
problems with the animation.

extra LinearLayout prevents the unnecessary redraw, as does separating
the two views by a 1 pixel margin. Looking at the code in the sdk it
seems the dirty rectangle for each view is (top, left, top + width,
bottom + width), which means neighboring clip and dirty rectangles
overlap by one pixel, causing the additional unwanted redraw.

Is this a but in the Android SDK, or is it intended. If intended, why?



2. Young French Dev need help

hi !
i'm trying to do an application which aims to put in the notification
bar the state of the latest Sms Report Status when you hit on a
button .
I searched in documentation and i found the SmsMessage object who has
method like .isSmsReportStatus() and .getStatus()

but, here is the problem , how can i fill the SmsMessage object ? i
don't know where to get what i need ....

i have to do this work because i'll show it in May to validate my
bachelor ...

thanks for help me .



3. How to determine size of a custom view

4. Villain Rom 2.0.1

5. forming xml and posting it ...

6. How to achieve ultra smooth OpenGL/ES animation

7. About calling feature in android