title: Custom view with buttons
body: <p>I need to build the following view:</p>
  
  <p><img src="https://i.stack.imgur.com/QkGNd.png" alt="enter image description here"></p>
  
  <p>Where the buttons can be regular buttons that are accessed from java code using <code>findViewById()</code> method.</p>
  
  <p>I'm not sure if i can do that using <a href="http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList" rel="nofollow noreferrer">LayerList</a> or if I need to implement a custom view from scratch? Can anyone suggest some path that I can follow to achieve this?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Right now I have this:</p>
  
  <p><img src="https://i.stack.imgur.com/DwzZ5.png" alt="enter image description here"></p>
  
  <p>What I need to do for now is:
   - hide what is outside the circle;
   - only parts of the buttons that are inside the cicle should fire the <code>onClick</code> event.</p>
  
  <p>Should I use a custom viewgroup to do that? I tried, but I wasn't able to draw the circle on top of the buttons (should be possible do that in the <code>onDraw()</code> method?)...</p>
  
  <p>Here is my code:</p>
  
  <p><strong>main_layout.xml</strong></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;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical" &gt;
  
          &lt;include layout="@layout/custom_layout" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>custom_layou.xml</strong></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="wrap_content"&gt;
  
      &lt;LinearLayout
          android:id="@+id/buttons_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingTop="14dp"
          android:paddingBottom="10dp"
          android:background="#CC0000FF"
          android:orientation="vertical"&gt;
  
          &lt;Button
              android:id="@+id/button1"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:text="Button1" /&gt;
  
          &lt;Button
              android:id="@+id/button2"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:text="Button2" /&gt;
  
          &lt;Button
              android:id="@+id/button3"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:text="Button3" /&gt;
  
          &lt;Button
              android:id="@+id/button4"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:text="Button4" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_alignTop="@+id/buttons_layout"
          android:layout_alignLeft="@+id/buttons_layout"
          android:layout_alignBottom="@+id/buttons_layout"
          android:src="@drawable/circle_foreground" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>circle_foreground.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="ring"
  android:innerRadius="100dp"
  android:thickness="0dp"
  android:useLevel="false" &gt;
  
  &lt;solid android:color="@android:color/transparent" /&gt;
  
  &lt;stroke android:width="4dp"
      android:color="#000000"/&gt;
  
  &lt;/shape&gt;
  </code></pre>