views:

37

answers:

1

Trying to create a widget with custom fonts, but read that widget doesn't support custom font.

I thought that I could create 10 png's for every number(0-10, not going to use abc ect).

By using that method I need to create several imageviews... that seems a waste of views.

So if I want to have the number 1337 I need 4 ImageViews. Isn't there a way to merge the png's (R.drawable), so I get a Bitmap or something and only one 1 ImageView?

A: 

You can create your own custom drawable (extends Drawable) where you pass the parameter (i.e. number) you want to draw. You would be overriding the

public void draw(Canvas canvas) {
   ....
   // use this to place another bitmap, i.e. number images, onto the canvas
   canvas.drawBitmap(..,..,..);  
   ...
}

method and merge the images into one drawable, that you then apply to your one single imageview.

Mathias Lin