title: Transparent Bitmap in ImageView
body: <p>I'd like to draw something over an existing bitmap while keeping the Bitmaps seperated. So the idea is to have a RelativeLayout and two ImageViews stacked onto each other, the top one holding the bitmap to be drawn to and the bottom one holding the bitmap with the background picture.</p>
  
  <p>layout.xml (only relevant part)</p>
  
  <pre><code>&lt;RelativeLayout
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"&gt;
      &lt;ImageView 
          android:id="@+id/photo_mask"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:background="@android:color/transparent" /&gt;
      &lt;ImageView 
          android:id="@+id/photo"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>layout.java (only relevant part)</p>
  
  <pre><code>setContentView(R.layout.layout);
  
  ImageView image = (ImageView) findViewById(R.id.photo);
  image.setImageBitmap(mSomeImage);
  
  mMaskPaint = new Paint();
  mMaskPaint.setColor(0xFF0000);
  mMaskPaint.setAlpha(128);
  
  mMaskBitmap = Bitmap.createBitmap(128, 128, Bitmap.Config.ARGB_8888);
  mMaskBitmap.eraseColor(Color.TRANSPARENT);
  
  mMaskCanvas = new Canvas(mMaskBitmap);
  mMaskCanvas.drawCircle(64, 64, 10, mMaskPaint);
  
  ImageView mask = (ImageView) findViewById(R.id.photo_mask);
  image.setImageBitmap(mMaskBitmap);
  </code></pre>
  
  <p>Note that mSomeImage is a 128x128 Bitmap, so it will match the mask Bitmap.
  I'm drawing a red circle in the middle of the mask Bitmap, which shows perfectly. However, the mask Bitmap doesn't show the background image through, instead showing a black background.</p>
  
  <p>So I tried:</p>
  
  <ul>
  <li>setting the background color of the ImageView to transparent</li>
  <li>setting the pixels of the mask Bitmap to transparent using .eraseColor</li>
  <li>setting the Bitmap config to ARGB_8888</li>
  <li>setting the alpha of the mask ImageView</li>
  </ul>
  
  <p>none of which seem to work. When I do a eraseColor(Color.BLUE), the background is blue with the red circle in the middle. When I set the alpha of the mask ImageView, the background is still black. When I comment out the setImageBitmap(mMaskBitmap), the background image shows.</p>
  
  <p>What am I missing here?</p>