如何绘制设备的 4 个角边缘中心
How to Draw 4 corner Edges center of device
我想使用 canvas 在设备中心绘制 4 个角边。
像这样
我正在尝试这个
Paint myPaint = new Paint();
myPaint.setColor(Color.GREEN);
myPaint.setStyle(Paint.Style.STROKE);
canvas.drawRect(
getLeft()+(getRight()-getLeft())/4,
getTop()+(getBottom()-getTop())/4,
getRight()-(getRight()-getLeft())/4,
getBottom()-(getBottom()-getTop())/3,myPaint);
我的结果
我是用9补丁图画的....
Bitmap b= BitmapFactory.decodeResource(getResources(), R.drawable.bg_scanner_frame);
paint.setColor(Color.RED);
canvas.drawBitmap(b, width/2-b.getWidth()/2, height/2-b.getHeight()/2, paint);
我想使用 canvas 在设备中心绘制 4 个角边。
像这样
我正在尝试这个
Paint myPaint = new Paint();
myPaint.setColor(Color.GREEN);
myPaint.setStyle(Paint.Style.STROKE);
canvas.drawRect(
getLeft()+(getRight()-getLeft())/4,
getTop()+(getBottom()-getTop())/4,
getRight()-(getRight()-getLeft())/4,
getBottom()-(getBottom()-getTop())/3,myPaint);
我的结果
我是用9补丁图画的....
Bitmap b= BitmapFactory.decodeResource(getResources(), R.drawable.bg_scanner_frame);
paint.setColor(Color.RED);
canvas.drawBitmap(b, width/2-b.getWidth()/2, height/2-b.getHeight()/2, paint);