title: Setting the size of a SurfaceView with SurfaceHolder.setFixedSize(width,height)
body: <p>As part of my MainActivity classes layout I have a SurfaceView:</p>
  
  <pre><code>                &lt;LinearLayout
                  android:id="@+id/screen_game"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="#0000FF"
                  android:orientation="vertical"
  
                  &gt;
                             &lt;Button
                          android:id="@+id/button15"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Button" /&gt;
  
                             &lt;com.ecslayout.BackgammonBoardView
                                 android:id="@+id/backgammonBoardView1"
                                 android:layout_width="100dp"
                                 android:layout_height="100dp" /&gt;
  
  
  
                  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I have defined for my SurfaceView a skeleton class (I have omitted much of the code for simplicity). Inside surfaceCreated I am trying many different ways
  to set the size of the canvas. The canvas does not appear to be changing size at all from 100dp x 100dp. All my attempts to call setFixedSize seem to have no effect on size at all:</p>
  
  <pre><code>            public class BackgammonBoardView extends SurfaceView implements SurfaceHolder.Callback {
  
  
                  public BackgammonBoardView(Context context, AttributeSet attrs) {
                      super(context, attrs);
  
                      Log.d(TAG,"SurfaceView Constructor.");
  
                      //register out interest in hearing about changes to our surface
                      SurfaceHolder holder = getHolder();
                      holder.addCallback(this);
  
                  }
  
  
                  //The method is firing just fine. I have the surfaceCreated output from Log.d
                  @Override
                  public void surfaceCreated(SurfaceHolder arg0) {
  
                      //Has no effect on size
                      //this.getHolder().setFixedSize(500, 500);
  
                      //Has no effect on size
                      //arg0.setFixedSize(500, 500);
  
                      //Has no effect on size
                      //SurfaceHolder holder = getHolder();
                      //holder.setFixedSize(500, 500);
  
                      //Has no effect on size
                      /*getHolder().setFixedSize(500,
                              500);*/
  
                      //Causes Eclipse to enter Debug mode. It crashes the program
                      //android.widget.FrameLayout.LayoutParams params = new android.widget.FrameLayout.LayoutParams(500, 500);
                      //setLayoutParams(params);
  
                      thread.start();
                      Log.d(TAG,"SurfaceView. surfaceCreated.");
                  }
  
  
              }
  </code></pre>
  
  <p>One of my questions about setFixedSize is what units do the parameters of the function represent? Are the int's for dot points or perhaps pixels? I'm reading the documentation:</p>
  
  <pre><code>http://developer.android.com/reference/android/view/SurfaceHolder.html
  </code></pre>
  
  <p>however it just says the parameters for setFixedSize are integers. I don't see yet where it describes what units the integers might represent. Am I perhaps trying to set the size of the SurfaceView from a bad location
   or is there some other problem? I'm developing targeting API 19 with a min API of 9.</p>
  
  <p>P.S. I think I see what is going on now setFixedSize() changes the resolution of the canvas but not its width and height in the LinearLayout as I was intending to do. I have gotten the screen width and height in the code behind and what I was intending to do is change the width and height of the SurfaceView as it exists in the layout.</p>
  
  <p>P.P.S. I was planning on using the SurfaceView inside of a ScrollView however I'm reading now that approach might not be possible. I'm finding out more from this post:</p>
  
  <pre><code>https://groups.google.com/forum/#!msg/android-developers/zkdnM0G225I/tt_FJGyOkB4J
  </code></pre>
  
  <p>Thank You</p>