android - How to draw gradient or stylish line canvas -


this activity using draw dotted line . want draw gradient or style in line ..

dragobserverlayout.java

//class draw line 1 place public class dragobserverlayout extends relativelayout {    float startx, starty, stopx, stopy;   private paint mpaint = new paint(paint.anti_alias_flag);   private list<rect> lines = new arraylist<rect>();   public list<path> linepath = new arraylist<path>();      //class dragging public dragobserverlayout(context context, attributeset attrs) {     super(context, attrs);     //setting color stroke , effect     mpaint.setcolor(color.red);     mpaint.setstyle(style.stroke);     mpaint.setstrokecap(paint.cap.butt);     mpaint.setpatheffect(new dashpatheffect(new float[] {5,5}, 0));     mpaint.setstrokewidth(10.0f);  }  //for canvas @override protected void dispatchdraw(canvas canvas) {     super.dispatchdraw(canvas);     final int count = lines.size();      (int = 0; < count; i++) {         final rect r = lines.get(i);          canvas.drawline(r.left, r.top, r.right, r.bottom, mpaint);      }  } 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -