【发布时间】:2017-07-15 02:38:24
【问题描述】:
我在一个线程的两个 List 数组上加载浮点值。 加载值后,将数组设置为两个 MainActivity 静态列表数组。
这些值完美地加载到 List 数组中。在扩展 Drawable 并覆盖 onDraw() 的 DummyDraw 类中,我能够根据 MainActivity List 数组中的值绘制圆圈,但是当我尝试 创建一个路径对象并将值加载到路径对象,然后尝试绘制路径,它不会绘制。这是 onDraw() 里面的代码:
//inside onDraw() on DummyDraw class which extends Draw-able:
//in the constructor:
path = new path();
//inside onDraw():
for(int u = 0; u < MainActivity.valueList.size(); u++){
float x = MainActivity.valueList.get(u);
float y = MainActivity.valueList2.get(u);
if(u==0)path.moveTo(x,y);else path.lineTo(x,y);
//canvas.drawCircle(x,y,0.5f*densityMultiplier,points);
}
canvas.drawPath(path,points);// this doesn't draw anything to the screen
任何想法或建议,谢谢。
【问题讨论】:
-
您是否将属性设置为
Paint对象(points)? -
当然可以。 @Adithya 我一直在阅读,我必须实现 path.rQuadTo()。我现在正在尝试实现此方法,但没有成功。