0

我尝试在图像上绘制文本,但它不起作用。这是我的代码:

ImageView image = (ImageView) findViewById(R.id.imageView1);
    Uri uri = Uri.parse("android.resource://mms.first/"+R.drawable.girl);
    Bitmap bitmap;
    try {
         ContentResolver cr = getContentResolver();
        bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, uri);

        //drawTextImage(bitmap);
         Canvas c = new Canvas(bitmap);
            Paint paint = new Paint();
            paint.setColor(Color.BLUE);
            paint.setStyle(Paint.Style.FILL);
            paint.setAntiAlias(true);
            paint.setTextSize(20);
            c.drawText("Golden Stag", 30, 200, paint);
        image.setImageBitmap(bitmap);
4

1 回答 1

0

这是代码:

 Bitmap bitmap;
  Resources resx = getResources();
  bitmap = BitmapFactory.decodeResource(resx, R.drawable.girl);

  Canvas canvas = new Canvas(bitmap.copy(Bitmap.Config.ARGB_8888, true));
于 2012-08-23T11:29:28.057 回答