当以下代码在模拟器上执行时android 2.3
它可以工作,但是当它运行时android 2.2
什么都没有出现......为什么?
public class BubbleView extends View {
Paint paint,paint2;
int pos, x2,y2;
public BubbleView(Context context) {
super(context);
init();
}
private void init(){
paint = new Paint();
paint.setAntiAlias(true);
paint.setStrokeWidth(5);
paint.setTextSize(25);
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.GREEN);
paint2 = new Paint();
paint2.setAntiAlias(true);
paint2.setStrokeWidth(5);
paint2.setTextSize(25);
paint2.setStyle(Paint.Style.STROKE);
paint2.setColor(Color.WHITE);
}
@Override
public void onDraw(Canvas canvas){
int x = getMeasuredWidth()/2;
int y = getMeasuredHeight()/2;
float r = Math.max(x, y)*0.6f;
canvas.drawCircle(x, y, 12 , paint);
canvas.drawCircle(x, y, r , paint);
canvas.drawLine(x-r, y, x+r, y, paint);
canvas.drawLine(x, y-r, x, y+r, paint);
}
}