我在imageview上写了一个字符串。现在,当在imageview上触摸手指时,前一个字符串将被覆盖。每次在imageview中的不同位置触摸手指时,我都不会覆盖前一个字符串。我怎么能做到这一点。谢谢
imageview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (action) {
case MotionEvent.ACTION_DOWN:
Bitmap.Config config = bm.getConfig();
int width = bm.getWidth();
int height = bm.getHeight();
bm2 = Bitmap.createBitmap(width, height, config);
c = new Canvas(bm2);
c.drawBitmap(bm, 0, 0, null);
paint = new Paint();
paint.setTextSize("14");
paint.setColor(Color.RED);
paint.setTypeface(TYPEFACE.NORMAL);
c.drawText(words, x, y, paint);
imageview.setImageBitmap(bm2);
break;
case MotionEvent.ACTION_UP:
break;
}
return true;