title: How to create a 'transparent circle inside rectangle' shape in XML in Android?
body: <p>I'm trying to create the following design in my app. </p>
  
  <p>Design Mockup<br>
  <a href="https://i.stack.imgur.com/vQp4R.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/vQp4R.jpg" alt="(https://photos.google.com/share/AF1QipPhCGTgf9zi7MetWJYm0NQ14c3wqzjqnEwxsajCFHEjqzt5R29qYvIjZ2C71q7EnQ?key=WUZKSXA1WVVwSlI2LVdTQy1IRjdUdzVuQlpCY0Rn)"></a></p>
  
  <p>Its an overlay on top of the main UI. Trying to create this using a layout on top of the main UI with its background as a translucent shape created in XML. However, even after reading multiple posts, I'm not able to figure it out.  </p>
  
  <p>I tried the following approach, but it didn't work. Created a ring shape with 200dp stroke and set it as source for a imageview and then set the scaletype to centerCrop but the shape does not scale as a bitmap does. </p>
  
  <p>Shape XML : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
      android:innerRadius="0dp"
      android:shape="ring"
      android:thicknessRatio="2"
      android:useLevel="false" &gt;
  
      &lt;solid android:color="@android:color/transparent" /&gt;
  
      &lt;stroke
          android:width="200dp"
          android:color="#80000000" /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>Overlay layout : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:src="@drawable/onboarding_background"
          android:scaleType="centerCrop"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Any pointers on how to do this or code would be really helpful.</p>