title: Webview in programmatically created RelativeLayout
body: <p>I need the following xml to be made in code:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical" android:gravity="right"
              android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#00000000"
              &gt;
              &lt;android.webkit.WebView android:layout_width="fill_parent"
              android:id="@+id/adview"
              android:scrollbars="none"
              android:layout_height="50dp"
              android:layout_alignParentLeft="true"
              android:layout_alignParentBottom="true"
              &gt;&lt;/android.webkit.WebView&gt;
              &lt;Button android:layout_width="wrap_content" android:text="x" android:textColor="#000000" 
              android:layout_height="wrap_content" android:id="@+id/hide_popup_button" android:background="#00000000" 
              android:layout_alignTop="@+id/adview" android:layout_alignParentRight="true"&gt;&lt;/Button&gt;
  
          &lt;/RelativeLayout&gt; 
  </code></pre>
  
  <p>I use the code below but I get a <code>Force close</code>:</p>
  
  <pre><code>RelativeLayout popwindow=new RelativeLayout(this);
  
          RelativeLayout.LayoutParams rl= new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, 50);
          popwindow.setLayoutParams(rl);
          WebView w= new WebView(this);
          w.setId(0X100);
          w.setScrollContainer(false);
          android.widget.RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)w.getLayoutParams();
          params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
          Button b=new Button(this);
          b.setId(0X101);
          b.setText("X");
          b.setBackgroundColor(Color.TRANSPARENT);
          b.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
          android.widget.RelativeLayout.LayoutParams paramsbut = (RelativeLayout.LayoutParams)b.getLayoutParams();
          paramsbut.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
          paramsbut.addRule(RelativeLayout.ALIGN_TOP,w.getId() );
          popwindow.addView(w,params);
          popwindow.addView(b,paramsbut);
          setContentView(popwindow);
  </code></pre>
  
  <p>I need suggestions on how to make that xml layout through java code.</p>