title: Determinate Circular Progressbar around Button
body: <p>I need to give scanning functionality in my android app. This is how my design looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/VXUBl.jpg" alt="enter image description here"></p>
  
  <p>I want to put circular <code>progressbar</code> (Yellow in colour) around the Scan Button. I have seen may tutorials but all of these put text inside the <code>progressbar</code>.</p>
  
  <p>This is what I have achieved so far:</p>
  
  <p><img src="https://i.stack.imgur.com/6wmSi.jpg" alt="enter image description here"></p>
  
  <p>Through this code:</p>
  
  <p>XML:
      </p>
  
  <pre><code>    &lt;ProgressBar
          android:id="@+id/progressbar"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:indeterminate="false"
          android:max="100"
          style="?android:attr/progressBarStyleLarge"/&gt;
  
      &lt;Button
          android:id="@+id/scanbutton"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:contentDescription="@string/scan"
          android:background="@drawable/scan_button"
          android:layout_gravity="center_horizontal"
          android:layout_centerInParent="true"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>NOTE: Setting <code>android:layout_centerInParent="true"</code> for <code>&lt;ProgressBar&gt;</code> makes it hidden behind the <code>&lt;Button&gt;</code>.</p>
  
  <p>JAVA:</p>
  
  <pre><code>Button ScanButton = (Button)findViewById(R.id.scanbutton);
  ProgressBar progressbar = (ProgressBar)findViewById(R.id.progressbar);
  ScanButton.setOnClickListener(new OnClickListener()
  {
      @Override
      public void onClick(View v)
      {
          new Thread(new Runnable()
          {
              public void run()
              {
                  while(status &lt; 100)
                  {
                      status += 1;
                      ScanScreen.this.progressbar.setProgress(status);
                      Thread.sleep(100);
                  }
              }
          }).start();
      }
  });
  </code></pre>
  
  <p>PROBLEM 1: <code>progressbar</code> is indeterminate and placement is not right.</p>
  
  <p>PROBLEM 2: JAVA code works for horizontal progressbar but crashes for circular one when the <code>button</code> is clicked.</p>
  
  <p>I know my problem is quite detailed. You don't need to solve it completely, just give me right directions.</p>