title: Add a ProgressBar into a custom view
body: <p>I could not find tips or examples about how to do this. I want to add a progressbar over a Rect that I have already drawn, so how I can I do this?</p>
  
  <p>Your answers will be truly appreciated! :) </p>
  
  <p><strong>Edited</strong></p>
  
  <pre><code>public class MainView extends View {
  
      public MainView(Context context) {
          super(context);
      }
  
      public MainView(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  
      @Override
      protected void onDraw(Canvas canvas) {
          super.onDraw(canvas);
  
          logo.set(getPX(5), getPX(10), getPX(65), getPX(70));
  
          background.set(getPX(30), getPX(2), canvas.getWidth() - getPX(10),
                  getPX(81));
  
          canvas.drawRect(background, paint);
          canvas.drawRect(logo, paint);
      }
  
      final private int getPX(float dp) {
          return (int) (getResources().getDisplayMetrics().density * dp);
      }
  }
  </code></pre>