How to create white border around bitmap?

后端 未结 8 1722
萌比男神i
萌比男神i 2021-02-12 19:24

For example I want a white border of 10pixel around all 4 side of the bitmap. I am not using it for imageview I am currently using this code to crop image. May I know how I coul

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-12 19:27

    Try this it will also add border to your canvas

        canvas.drawLine(0, 0, canvas.getWidth(), 0, paint2);
            canvas.drawLine(0, 0, 0, canvas.getHeight(), paint2);
            canvas.drawLine(0, canvas.getHeight(), canvas.getWidth(),
                    canvas.getHeight(), paint2);
            canvas.drawLine(canvas.getWidth(), 0, canvas.getWidth(),
                    canvas.getHeight(), paint2);
    

提交回复
热议问题