title: ImageView.getWidth() returns 0
body: <p>I get imageView's width 0. Below is code.</p>
  
  <p><strong>xml file :</strong></p>
  
  <pre><code>&lt;ImageView
          android:id="@+id/img"
          android:layout_width="200dp"
          android:layout_height="200dp" /&gt;
  </code></pre>
  
  <p><strong>Activity :</strong></p>
  
  <pre><code>@Override
  protected void onResume() {
      super.onResume();
      ImageView img = (ImageView) findViewById(R.id.img);
      Log.d(TAG, "width : " + img.getWidth());
  }
  </code></pre>
  
  <p>I don't want to use below code as I need to place this code in so many places.</p>
  
  <pre><code>ViewTreeObserver vto = img.getViewTreeObserver();
      vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
          public boolean onPreDraw() {
              ImageView img = (ImageView) findViewById(R.id.img);
                      Log.d(TAG, "width : " + img.getWidth());
              return true;
          }
      });
  </code></pre>
  
  <p><strong>My workaround :</strong>
  I actually later did not need to add this code in an activity. I added it to a non-activity class and instead of ImageView's width I used Bitmap image's width and now does not have this problem.</p>