I had some problems with setting background too, namelly in an
Activity !

The background image is always stretched or compressed in order to fit
the window.
Besides not having any options, for tiling, stretching, etc. the real
problem is that this is always done in every redraw.

What I mean is, if for example, you have a larger image for the
background, in order to cover the case for larger screens (yes I know
you can define one for each supported screen size in resources), it
will autoresize the image on every redraw of the activity window! And
this is slow as hell !
if instead you just place your background image on the top left, using
a drawable, it's many times faster, since now, it will clip the image
correctly (no stretching done), and so resizing of image is avoided !

Even if background resizing is a wanted feature, the resize result
should be cached since the background (or it's size) won't change that
often, at least not on every redraw !

It would also be nice to be abel to control the background drawing
with a Matrix, like everything else in a regular canvas.
Of course a few shortcuts, for stretch, tile, etc, could be defined
using a shader or similar.

About your question, see below.

On May 14, 4:17 am, "Bill.Tsao" <[EMAIL PROTECTED]> wrote:
> Dear all:
>
> When I set a graph to be background in "TextView" and "Button" ,
>
> I found that it was stretch in "TextView" and it was its original
> size.

Yes
Not very consistent, but they are on different level contexts.
But a generic solution, like mentioned above would be better.


>
> I have three questions:
>
> 1. Does " set background function " do the different things in that
> two different
>     object ?

Yes it does, in this case, a method in one object, doesn't have to
have the same functionality of another one, but it would be nice if it
was similar, contextually.

>
> 2.Can I decide the graph position in my button?

I think not !
By default, background will cover the entire button area.
You can however edit you image, and eventually make it transparent in
some places, if required using a PNG image file.

>
> 3.Can I tile my graph in my button?

As far as I know, backgrounds have no fancy features, unlike the rest
of the 2D API.
So, if you want to tile an image, increase your image size, and edit
it to look as if it was tiled!
(of course, you will loose any size benefits that real tilling would
have provided)

--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to