[android-developers] How to Draw a Button in a View
hi guys,
i have a class which extends a View and i'm drawing few images in the
canvas.
and i want to draw two buttons as well. could someone tell me how to
do this???
this is my class
public class DrawView extends View {
private ColorBall colorball1;
String[] str;
int width, height;
Context ctx;
public DrawView(Context context, int width, int height, InputStream
is,
String[] str) {
super(context);
setFocusable(true); // not yet necessary, but you never know what
the
// future brings
// declare each ball with the ColorBall class
// if(color.equals("blue")){
this.ctx = context;
this.str = str;
this.height = height;
this.width = width;
colorball1 = new ColorBall(context, is, height, width);
}
@Override
protected void onDraw(Canvas canvas) {
colorball1.moveBall(5, 3);
// draw the balls on the canvas
canvas.drawBitmap(colorball1.getBitmap(), colorball1.getX(),
colorball1
.getY(), null);
Button btnAnswer = (Button) findViewById(R.id.button1);
Button btnEnd = (Button) findViewById(R.id.button2);
// refresh the canvas
invalidate();
}
}
even i have created two button but how can i make them visible??
regards,
Mike
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home