title: Adding items to the ScrollView dynamically make it doesn't scroll
body: <p>I have a simple layout:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="300dp"
  android:padding="15dp"&gt;
  
  
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:id="@+id/scrollLayout"&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/ScrollView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Now, I inflate the outer <code>RelativeLayout</code> to retrieve the inner <code>LinearLayout</code> to put items in it.</p>
  
  <pre><code>RelativeLayout relative =  (RelativeLayout) LayoutInflater.from(activity).inflate(R.layout.gradient_pick_view, null);
  LinearLayout view = (LinearLayout) relative.findViewById(R.id.scrollLayout);
  </code></pre>
  
  <p>After that I created a method to add some buttons to it:</p>
  
  <pre><code>for(int i=0;i&lt;10;i++){
       LinearLayout wrapper = (LinearLayout) LayoutInflater.from(activity).inflate(R.layout.button_wrapper, null);
       Button button = (Button)wrapper .findViewById(R.id.button);
       view.addView(layout);
  }
  </code></pre>
  
  <p>Everything works fine, but it doesn't scroll.
  What am I doing wrong here?</p>
  
  <p>Here's the screenshot (displaying 7 of 10 buttons):
  <a href="https://i.stack.imgur.com/0otqO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0otqO.png" alt="enter image description here"></a></p>
  
  <p>I forgot to mention - I'm using a <code>MaterialDialog</code> library and add this RelativeLayout as a custom view to a dialog.</p>