Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经有了 DrawView,但一次只能画 1 条线。如果我再次尝试绘制最后一行删除,我该如何“保存”它们?
onDraw 刷新整个画布。要打印多行,您可以将这些行存储在模型中(例如 Line 对象的集合):
@Override public void onDraw(Canvas canvas) { for (Line l : lines) { canvas.drawLine(l.x1, l.y1, l.x2, l.y2, paint); } }