我希望在我的安卓应用中的画布上画一个圆。我搜索了很多,发现如果需要一种可以随时更新的动态绘画形式,需要使用画布而不是imageView。
非常感谢您的帮助
这是我目前写的代码,但它没有在安卓设备屏幕上绘制任何东西:
private void createBitMap() {
Bitmap bitMap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); //creates bmp
bitMap = bitMap.copy(bitMap.getConfig(), true); //lets bmp to be mutable
Canvas canvas = new Canvas(bitMap); //draw a canvas in defined bmp
Paint paint = new Paint(); //define paint and paint color
paint.setColor(Color.RED);
paint.setStyle(Style.FILL_AND_STROKE);
//paint.setAntiAlias(true);
canvas.drawCircle(50, 50, 10, paint);
}