title: android:layout_centerInParent / RelativeLayout
body: <p>i have 3 layers, all of them are RelativeLayouts or based on it:</p>
  
  <ol>
  <li><p>content-class</p></li>
  <li><p>overlay-class</p></li>
  <li><p>infobox-layout</p></li>
  </ol>
  
  <p>In my code i generate an Overlay-object which inflates a infobox-layout. And then i add the Overlayer to the Content-Layer.
  My goal is to center (vertical and horizontal) the Info-box  in parent (=overlay) but it doesn't work. It's TOP/LEFT. This is the default behavior, I think.
  So here is my code. 
  I add the Overlayer to the Content-Layer like this:</p>
  
  <pre><code>private void openContent (String url,final ContentLayer content) {
     overlay = new Overlay(context, url);
     content.addView(overlay);
  }
  </code></pre>
  
  <p>Here is the Overlayer:</p>
  
  <pre><code>public class Overlay extends RelativeLayout {
  
     // some stuff
  
     public Overlay(Context context, String url) {
      super(context);
      this.context = context;
      this.url  = url;
      init(context, null, -1);
     }
  
  
     private void init(Context context, AttributeSet attrs, int defStyle) {
      this.setTag(context.getResources().getString(R.string.overlay));
      RelativeLayout.LayoutParams lp =     new RelativeLayoutout.LayoutParams(LayoutParams.MATCH_PARENT,
                    LayoutParams.MATCH_PARENT);
  
      this.setLayoutParams(lp);
      this.setBackgroundColor(context.getResources().getColor(R.color.black));
      this.getBackground().setAlpha(80);
      isMax = getValueInPrefs();
      inflateLayout();
  
    }
  
   private void inflateLayout () {
    String service = Context.LAYOUT_INFLATER_SERVICE;
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(service);
    inflater.inflate(R.layout.infobox_wrapper, this, true);
  
   }
  // some stuff
  }
  </code></pre>
  
  <p>Last but no least, here is my infobox-layout, called infobox_wrapper.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/epaper_webview_wrapper"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_centerInParent="true"&gt; &lt;!-- DOESN'T WORK!! --&gt;
  
     &lt;RelativeLayout
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="@color/grau_actionbar"&gt;
        &lt;Button
          android:id="@+id/header_button_close" 
          android:layout_width="50dp"
          android:layout_height="50dp"
          android:text="X"
          android:layout_alignParentRight="true"
          android:layout_margin="5dp"/&gt;
        &lt;Button
          android:id="@+id/header_button_min_max" 
          android:layout_width="50dp"
          android:layout_height="50dp"
          android:text="M"
          android:layout_toLeftOf="@id/header_button_close"
          android:layout_margin="5dp"/&gt;
      &lt;/RelativeLayout&gt;
      &lt;RelativeLayout
         android:id="@+id/webview_container"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="@color/grau_actionbar"
         android:layout_below="@id/header"&gt;
         &lt;WebView 
           android:id="@+id/epaper_webview"
           android:layout_width="match_parent"
           android:layout_height="match_parent"/&gt;
       &lt;/RelativeLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I am thankful for any help or hint. </p>