我想在日志图中设置开/关和休息时间的数据,
用户也可以像这样编辑数据:
答案 0 :(得分:0)
您可以在自View扩展的自定义视图中绘制画布
java: void drawCanvas(Canvas canvas){
Paint paint;
RectF bezierRect = new RectF(30.5f, 23.5f, 213.5f, 92.5f);
Path bezierPath = new Path();
bezierPath.moveTo(30.5f, 32.5f);
bezierPath.lineTo(85.5f, 32.5f);
bezierPath.lineTo(85.5f, 70.5f);
bezierPath.lineTo(146.5f, 70.5f);
bezierPath.lineTo(146.5f, 46.5f);
bezierPath.lineTo(173.5f, 46.5f);
bezierPath.lineTo(173.5f, 82.5f);
bezierPath.lineTo(199.5f, 82.5f);
bezierPath.lineTo(199.5f, 23.5f);
bezierPath.lineTo(213.5f, 23.5f);
bezierPath.lineTo(213.5f, 92.5f);
paint = new Paint();
paint.setStrokeWidth(1f);
paint.setStrokeMiter(10f);
canvas.save();
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.BLACK);
canvas.drawPath(bezierPath, paint);
canvas.restore();
}
kotlin:
fun drawCanvas(canvas: Canvas) {
val paint: Paint
val bezierRect = RectF(30.5f, 23.5f, 213.5f, 92.5f)
val bezierPath = Path()
bezierPath.moveTo(30.5f, 32.5f)
bezierPath.lineTo(85.5f, 32.5f)
bezierPath.lineTo(85.5f, 70.5f)
bezierPath.lineTo(146.5f, 70.5f)
bezierPath.lineTo(146.5f, 46.5f)
bezierPath.lineTo(173.5f, 46.5f)
bezierPath.lineTo(173.5f, 82.5f)
bezierPath.lineTo(199.5f, 82.5f)
bezierPath.lineTo(199.5f, 23.5f)
bezierPath.lineTo(213.5f, 23.5f)
bezierPath.lineTo(213.5f, 92.5f)
paint = Paint()
paint.setStrokeWidth(1f)
paint.setStrokeMiter(10f)
canvas.save()
paint.setStyle(Paint.Style.STROKE)
paint.setColor(Color.BLACK)
canvas.drawPath(bezierPath, paint)
canvas.restore()
}