title: Android - Buttons added programatically fall off the screen
body: <p>I have added buttons programatically on screen but some of the buttons fall of the screen. How can I do that all buttons will show on the screen. I have the following code on adding the buttons programatically.</p>
  
  <pre><code>for (String string : str_array) {
              counter++;
              final int value = counter;
              LinearLayout l_layout = (LinearLayout) findViewById(R.id.linear_layout); 
              l_layout.setOrientation(LinearLayout.HORIZONTAL);
  
              Button btn = new Button(this);
              btn.setText(string);
              btn.setId(counter);
              l_layout.addView(btn);
  
          }
  </code></pre>
  
  <p>Then I have this code in my xml:</p>
  
  <pre><code>&lt;LinearLayout
          android:id="@+id/linear_layout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="horizontal" &gt;
  &lt;/LinearLayout&gt;
  </code></pre>