title: use setLayoutParams() but it doesn't work
body: <p>I create a custom view-MyImageView-to draw a bitmap in it,i use setLayoutParams() to set my view's width and height,but it doesn't work,i use log to track my view's width and height,i found that both of them are 0,why the width and height are not both 300? here's part of my main activity code:</p>
  
  <pre><code>    myCanvas=new MyImageView(CanvasTest3Activity.this,Path);
      LinearLayout.LayoutParams p=new LinearLayout.LayoutParams(300,300);
      myCanvas.setLayoutParams(p);
  </code></pre>
  
  <p>here's part of my MyImageView 's code:</p>
  
  <pre><code>    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
      super.onMeasure(widthMeasureSpec, heightMeasureSpec);
      int parentwidth=MeasureSpec.getSize(widthMeasureSpec);
      int parentHeight=MeasureSpec.getSize(heightMeasureSpec);
      int mywidth=(int)(parentHeight*0.5);
      setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),mywidth);
      }
  </code></pre>