我有这个类可以扩展View
并画一条线:
public class MyDraw extends View
{
Paint paint = new Paint();
public MyDraw(Context context)
{
super(context);
paint.setColor(Color.BLUE);
}
@Override
public void onDraw(Canvas canvas)
{
super.onDraw(canvas);
canvas.drawLine(1, 1, 100, 100, paint);
}
}
我想使用现有的视图Context
来绘制它。可能吗?