我試圖在放置爲res/drawable/schoolboard.png
的圖像上畫一個圓。圖像填充活動背景。以下不起作用:在現有圖像上畫一個圓圈
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.schoolboard);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(Color.BLUE);
Canvas canvas = new Canvas(bitmap);
canvas.drawCircle(60, 50, 25, paint);
ImageView imageView = (ImageView)findViewById(R.drawable.schoolboard);
imageView.setAdjustViewBounds(true);
imageView.setImageBitmap(bitmap);
任何幫助將不勝感激。謝謝。
謝謝你們倆!改變了xml文件的圖像視圖,因爲在schoolboard圖像被定義爲'android:background =「@ drawable/schoolboard」'在RelativeLayout中。現在它工作! – Kfir