title: Put ProgressBar in CENTER of the screen programmatically
body: <p>I'm making a class which is extending <code>LinearLayout</code>. In that I'm trying to make layout programmatically. Here is what I have done so far:</p>
  
  <pre><code>RelativeLayout.LayoutParams parentParam = new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.MATCH_PARENT,
              RelativeLayout.LayoutParams.MATCH_PARENT);
  
      this.setLayoutParams(parentParam);
      this.setOrientation(LinearLayout.VERTICAL);
  
      WebView webView = new WebView(context);
      LinearLayout.LayoutParams webViewParam = new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.MATCH_PARENT,
              LinearLayout.LayoutParams.MATCH_PARENT);
  
      webView.setLayoutParams(webViewParam);
      this.addView(webView);
  
      pb = new ProgressBar(context);
      LinearLayout.LayoutParams pbParam = new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.WRAP_CONTENT,
              LinearLayout.LayoutParams.WRAP_CONTENT);
      pbParam.gravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;
      pb.setLayoutParams(pbParam);
      webView.addView(pb);
  </code></pre>
  
  <p>My all things are working fine, <code>WebView</code> and <code>ProgressBar</code> are visible and doing there respective task, but I'm trying to put <code>ProgressBar</code> in the <code>CENTER</code> of the screen. </p>
  
  <p>What am I missing here. Any kind of input will be appreciated.</p>
  
  <p><strong>EDIT:</strong>
  The output right now looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/po50D.png" alt="enter image description here"></p>