私はView
でモノを使って簡単なアニメーションを作成しようとしています。単純なキャンバスを使用したアニメーションビュー
public class DemoView : View
{
public DemoView(Context context, IAttributeSet attrs) :
base(context, attrs)
{
Initialize();
}
public DemoView(Context context, IAttributeSet attrs, int defStyle) :
base(context, attrs, defStyle)
{
Initialize();
}
private void Initialize()
{
}
protected override void OnDraw(Android.Graphics.Canvas canvas)
{
base.OnDraw(canvas);
canvas.DrawColor(Color.Blue);
Paint pen = new Paint();
pen.Color = Color.Red;
pen.StrokeWidth = 2;
pen.SetStyle(Paint.Style.Stroke);
canvas.DrawLine(0, 0, 25, 25, pen);
}
//How to add other lines to form an animation?
}
上記のコードは、単に青色のバックグラウンドをレンダリングして線を描画:
は、ここに私のコードです。私はメソッドを探しています(私はOnPaint
のようなものを信じていますので、アプリケーションが開いている間に線を引くことができます)。
の責任でした。アニメーションを作成するためにさまざまなことを描く –