title: ScrollView inside a ViewPager
body: <p>So I have a <code>ScrollView</code> as the first view of a <code>ViewPager</code>. The following code renders correctly, but it simply does not scroll.</p>
  
  <p>ShadeDisplay.java</p>
  
  <pre><code>public class ShadeDisplay extends SherlockFragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle ParthMehrotra) {
          if (container == null) {
              return null;
          }
  
          ScrollView sv = new ScrollView(getSherlockActivity());
          sv.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
          LayoutParams.FILL_PARENT));
          sv.setFillViewport(true);
          sv.setBackgroundColor(Color.BLACK);
  
          LinearLayout ll = new LinearLayout(getSherlockActivity());
          ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
          LayoutParams.WRAP_CONTENT));
          ll.setOrientation(LinearLayout.VERTICAL);
  
          ImageView iv = new ImageView(getSherlockActivity());
          iv.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
          LayoutParams.WRAP_CONTENT));
          iv.setImageResource(R.drawable.banner);
          ll.addView(iv);
  
          Pattern patern1 = new Pattern(getSherlockActivity());
          patern1.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  
          Pattern patern2 = new Pattern(getSherlockActivity());
          patern2.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  
          ll.addView(patern1);
          ll.addView(patern2);
  
          sv.addView(ll);
          return sv;
      }
  
  }
  </code></pre>
  
  <p>Pattern.java</p>
  
  <pre><code>public class Pattern extends View {
  
      Paint[] shade = new Paint[5];
  
      public Pattern(Context context) {
          super(context);
  
          for (int i = 0; i &lt; shade.length; i++) {
              shade[i] = new Paint();
          }
  
          shade[0].setColor(Color.RED);
          shade[1].setColor(Color.BLUE);
          shade[2].setColor(Color.GREEN);
          shade[3].setColor(Color.YELLOW);
          shade[4].setColor(Color.CYAN);
      }
  
      @Override
      public void onDraw(Canvas canvas) {
          super.onDraw(canvas);
  
          canvas.drawRect(0, 0, getWidth(), getWidth() / 3, shade[0]);
          canvas.drawRect(((getWidth() / 3) * 2), 0, getWidth(), getWidth(),
                  shade[1]); 
          canvas.drawRect(0, ((getWidth() / 3) * 2), getWidth(), getWidth(),
                  shade[2]);
          canvas.drawRect(0, (getWidth() / 3), getWidth()/3, getWidth(), 
                  shade[3]);
          canvas.drawRect(getWidth() / 3, getWidth() / 3, ((getWidth() / 3) * 2),
                  ((getWidth() / 3) * 2), shade[4]);
  
      }
  }
  </code></pre>
  
  <p>I know I must be overlooking something really silly but I can't find the solution anywhere.</p>