title: Programmatically using MATCH_PARENT for a RelativeLayout inside a FrameLayout
body: <p>I'm subclassing HorizontalScrollView (which is a FrameLayout) and adding a RelativeLayout to it programmatically.</p>
  
  <p>The FrameLayout correctly fills the parent view, but RelativeLayout inside doesn't show up.</p>
  
  <p>MainActivity::OnCreate()</p>
  
  <pre><code>setContentView(R.layout.activity_main); 
  CustomHorizontalScrollView custom = new CustomHorizontalScrollView(this); 
  ViewGroup contentView = (ViewGroup) findViewById(R.id.content); 
  contentView.addView(custom,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 180));
  </code></pre>
  
  <p>CustomHorizontalScrollView::Constructor()</p>
  
  <pre><code>this.setBackgroundColor(Color.MAGENTA);
  relativeLayout = new RelativeLayout(context);
  relativeLayout.setBackgroundColor(Color.BLACK);
  this.addView(relativeLayout, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
  </code></pre>
  
  <p>Result:</p>
  
  <p><img src="https://i.stack.imgur.com/BGiUE.png" alt="RelativeLayout not showing up"></p>
  
  <p>The RelativeLayout should be black and should fill parent but is not.</p>
  
  <p>The weird thing is that if I specify width and height in pixels instead using MATCH_PARENT, the RelativeLayout appears.</p>
  
  <pre><code>this.addView(relativeLayout, new FrameLayout.LayoutParams(90, 90));
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/FgCII.png" alt="enter image description here"></p>
  
  <p>Does that mean that I can't use MATCH_PARENT when programmatically adding a RelativeLayout to a FrameLayout? Or am I missing something? Or maybe HorizontalScrollView only supports having a child with fixed width and height?</p>