title: Android view to bitmap with tranparency
body: <p>I need to convert TextView to bitmap. TextView has transparency using the setAlpha() method. I am using following code</p>
  
  <pre><code>Bitmap b = getBitmapFromView(textView , 150);
  try {
      b.compress(Bitmap.CompressFormat.PNG, 95, new FileOutputStream(watermarkImagePath));
  } catch (FileNotFoundException e) {
      e.printStackTrace();
  }
  
  public Bitmap getBitmapFromView(View view, int alpha) {
      view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
      Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(),
              Bitmap.Config.ARGB_8888);
      Canvas canvas = new Canvas(bitmap);
      Paint alphaPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
      alphaPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT));
      alphaPaint.setColor(Color.TRANSPARENT);
      Toast.makeText(VideoCaptureActivity.this, "alpha" + alpha, Toast.LENGTH_LONG).show();
      alphaPaint.setAlpha(alpha);
      canvas.drawBitmap(bitmap,0,0,alphaPaint);
      view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
      view.draw(canvas);
      return bitmap;
  }
  </code></pre>
  
  <p>but the issue is that the result image has no transparency :(</p>