drawCircle pintando mapas de bits?

¿Es posible paint a drawCircle with an image instead of just a colour? If so, how? If not, is there a way I could make it look like there is? Thanks.

preguntado el 09 de marzo de 12 a las 13:03

1 Respuestas

You can draw multiple images onto your Canvas and at desired coordinates, like you can draw your circles. Use the establecer límites method properly to assign the exact coordinates where you would want the images to be drawn. Here's a sample code :

public class MyDrawableView extends View {
private Drawable mD1;
private Drawable mD2;

public MyDrawableView(Context context) {
    super(context);

    Resources res = context.getResources();
    mD1 = res.getDrawable(R.drawable.image1);
    //Set image1 bounds using : mD1.setBounds(x, y, x + width, y + height);

    mD2 = res.getDrawable(R.drawable.image2);
    //Set image2 bounds using : mD2.setBounds(a, b, a + width, b + height);
}

protected void onDraw(Canvas canvas) {
    mD1.draw(canvas);
    mD2.draw(canvas);
}
}

respondido 09 mar '12, 13:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.