title: How to change size of a layout inside ScrollView?
body: <p>I have a custom View that is nested inside ScrollView and HorizontalScrollView like this: </p>
  
  <pre><code>&lt;HorizontalScrollView&gt;
      &lt;ScrollView&gt;
          &lt;GameView&gt;
          &lt;/GameView&gt;
      &lt;/ScrollView&gt;
  &lt;/HorizontalScrollView&gt;
  </code></pre>
  
  <p>I want to change the GameView size depending on user action (zooming in or out) but when I try to do </p>
  
  <pre><code>gameView.setLayoutParams(new LayoutParams((int)(gameView.BOARD_WIDTH * gameView.STEP), (int)(gameView.BOARD_HEIGHT * gameView.STEP)));
  </code></pre>
  
  <p>I get an exception: </p>
  
  <pre><code>java.lang.ClassCastException: android.view.ViewGroup$LayoutParams
  
  at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1066)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  at android.widget.ScrollView.onMeasure(ScrollView.java:296)
  at android.view.View.measure(View.java:8313)
  android.widget.HorizontalScrollView.measureChildWithMargins(HorizontalScrollView.java:1075)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  at android.widget.HorizontalScrollView.onMeasure(HorizontalScrollView.java:302)
  at android.view.View.measure(View.java:8313)
  at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
  at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
  at android.view.View.measure(View.java:8313)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  at android.view.View.measure(View.java:8313)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  at android.view.View.measure(View.java:8313)
  at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:130)
  at android.app.ActivityThread.main(ActivityThread.java:3683)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Is there a way of changing the size of the gameView?</p>
  
  <p>Edit: I have solved the issue, the anwser was:</p>
  
  <pre><code>gameView.setLayoutParams(new ScrollView.LayoutParams((int)(BOARD_WIDTH * STEP), (int)(BOARD_HEIGHT * STEP)));
  </code></pre>