开发者

Android: Draw a scalable rectangle(Should change colours on my input)around a bitmap

开发者 https://www.devze.com 2022-12-19 09:34 出处:网络
开发者_如何学运维Can anybody help me to draw a scalable rectangle around a bitmap And such that 1) The rectangle should scale based on the size of my bitmap

开发者_如何学运维Can anybody help me to draw a scalable rectangle around a bitmap And such that 1) The rectangle should scale based on the size of my bitmap 2) The colour of my rectangle should change on my input any help would be appreciated Thank you


You can create class extending View, and override onDraw and onTouchEvent methods.


Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.MAGENTA);
DashPathEffect dashPath =new DashPathEffect(new float[ ]{70,2}, 30);
paint.setPathEffect(dashPath);
paint.setStrokeWidth(80);
canvas.drawLine(30, 300 , 320, 300, paint);
0

精彩评论

暂无评论...
验证码 换一张
取 消