title: How to use a custom shape as a frame to an ImageView android
body: <p>I'm trying to add a hexagonal custom frame to an <code>ImageView</code>. </p>
  
  <p>Approach I tried : </p>
  
  <p>Created a hexagon shape in <code>drawable</code> folder.</p>
  
  <p><code>drawable/ic_hexagon.xml</code> file</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:innerRadius="0dp"
  android:thicknessRatio="1.9"
  android:useLevel="false"&gt;
  &lt;solid android:color="@android:color/transparent"/&gt;
  &lt;path android:fillColor="#00ffffff"
      android:pathData="m723,314c-60,103.9 -120,207.8 -180,311.8 -120,0 -240,0 -360,0C123,521.8 63,417.9 3,314 63,210.1 123,106.2 183,2.2c120,0 240,0 360,0C603,106.2 663,210.1 723,314Z"
      android:strokeColor="#000000" android:strokeWidth="10"/&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>Then created <code>filter.xml</code> file using <code>layer-list</code> and added it as the background of the ImageView.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:drawable="@drawable/img"/&gt;
      &lt;item android:drawable="@drawable/ic_hexagon"/&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p><code>layout.xml</code> file</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;ImageView
          android:id="@+id/imageView5"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:background="@drawable/filter"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I followed <a href="https://stackoverflow.com/a/22105820/4905918">this</a> answer. But I wasn't able to apply this answer for custom hexagon. This is a sketch of the layout I'm trying to achieve.</p>
  
  <p><a href="https://i.stack.imgur.com/1sX9z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1sX9z.png" alt="Image"></a></p>
  
  <p>PS : I'm trying to use the hexagon as a frame. The hexagon shape is working. But it cannot be used as a frame.</p>
  
  <p>Please help me with this. Thanks.  </p>