我尝试在活动中创建两个圆圈。但我真正想要完成的是在触摸移动上画一条线。用户将能够根据手指的移动使用他/她的手指绘制一条线。这就是我如何为我的画点画的。
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
currentLevel = Intent.GetIntExtra("gameLevel", 0);
playerScore = Intent.GetIntExtra("score", 0);
SetContentView(new SampleView(this));
// Create your application here
}
private class SampleView : View
{
private Paint mPaint;
public SampleView(Context context)
: base(context)
{
Focusable = true;
mPaint = new Paint();
mPaint.AntiAlias = true;
}
protected override void OnDraw(Canvas canvas)
{
canvas.DrawColor(Color.White);
canvas.Translate(10, 10);
canvas.SaveLayerAlpha(0, 0, 200, 200, 0x88, SaveFlags.All);
mPaint.Color = Color.Red;
canvas.DrawCircle(75, 75, 75, mPaint);
mPaint.Color = Color.Blue;
canvas.DrawCircle(125, 125, 75, mPaint);
canvas.Restore();
}
}