title: Android: Prepend LinearLayout programmatically
body: <p>I created a layout in my application that includes the followings:<br>
  <code>main_layout</code> (<code>FrameLayout</code>, fills whole screen)<br>
  -> includes: <code>main_interface</code> (<code>LinearLayout</code>, height/width fills parent)</p>
  
  <p>Now I want to add another <code>LinearLayout</code> in the <code>main_layout</code> BEFORE the <code>main_interface</code>.
  I tried this:</p>
  
  <pre><code>LinearLayout bar = new LinearLayout(this);
          bar.setGravity(Gravity.TOP);
          LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
          bar.setLayoutParams(params);
          main_layout.addView(bar);
  </code></pre>
  
  <p>but this just overlaps my <code>main_interface</code>.<br><br>
  Any Help?</p>