title: Android LinearLayout fill with buttons
body: <p>I want to fill the LinearLayout with buttons.</p>
  
  <p>The way I want it, is by filling the top of the screen first until the end of the line then if there is no space left, go to the next line and so on, like in the below picture.</p>
  
  <p><a href="https://i.stack.imgur.com/AxjPB.png" rel="nofollow"><img src="https://i.stack.imgur.com/AxjPB.png" alt="enter image description here"></a></p>
  
  <p>I tried this code but it fill the screen vertically</p>
  
  <pre><code>    LinearLayout layout = (LinearLayout) findViewById(R.id.linear_layout_tags);
      //layout.setOrientation(LinearLayout.VERTICAL);
      layout.setGravity(Gravity.FILL);
      Button bt1 = new Button(this);
      bt1.setText("A Button");
      bt1.setLayoutParams(new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT));
      layout.addView(bt1);
  </code></pre>
  
  <p>Any help or suggestions would be appreciated.</p>