append paint objects android
I am trying开发者_如何学运维 to display a dynamic paint window in android, I want to make a red line move across the rectangular pulses that have been generated.
Here is the code for generating 4 pulses
canvas.drawLine(ps, size ,(p0+p1) , size, paint);//start x,start y,stop x,stop y
canvas.drawLine((p0+p1+p2), size ,(p0+p1+p2+p3) , 300, paint);
canvas.drawLine((p0+p1+p2+p3+p4), size ,(p0+p1+p2+p3+p4+p5) ,size, paint);
canvas.drawLine((p0+p1+p2+p3+p4+p5+p6) , size ,(p0+p1+p2+p3+p4+p5+p6+p7),size, paint);
now I want a red line to slide across the x axis (imaginary ) from (0,0) until the end of window with a movement at every 200 msec. Can someone suggest a way to do it. Thanks
Use the Runnable and Handler objects and Handler's postDelayed function. In the run() function of the runnable, redraw the lines with relevant co-ordinates.
精彩评论