Measuring an ImageView after loading an image
<p>Im trying to find a way to measure an <code>ImageView</code> after an image has been loaded into it using Glide or Picasso (or anything really). Basically, im trying to layout other views on top of the image in certain positions, but need the final ImageViews dimensions to do so accurately. </p>

<p>Im not sure what the best layout to use to try and do this would be, but im currently using this:</p>

<pre><code>&lt;FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"&gt;
        &lt;ImageView
            android:id="@+id/viewingImageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/&gt;
    &lt;/FrameLayout&gt;
</code></pre>

<p>and loading the image into <code>viewingImageView</code>. These are both inside a root FrameLayout as well but I dont think that matters.</p>

<p>This is my latest attempt, but as commented, using <code>.getWidth()</code> and <code>.getHeight()</code> on the ImageView return 0. The width/height of the resource returns the size of the original image.</p>

<p><strong>Glide</strong></p>

<pre><code>.with(this)
.load(entry.getImageUrl())
.asBitmap()
.into(new SimpleTarget&lt;Bitmap&gt;() {
    @Override
    public void onResourceReady(Bitmap resource, GlideAnimation&lt;? super Bitmap&gt; glideAnimation) {
        mImageView.setImageBitmap(resource);

        int width = mImageView.getMaxWidth(); //prints 0
        int height = mImageView.getMaxHeight(); //prints 0
        int resw = resource.getWidth(); //returns original image width
    }
});
</code></pre>

<p>So how can I get the image loaded and then measure the ImageView (or its wrapping FrameLayout) after the image has been loaded? Or if possible, measuring the dimensions of the finally laid out image would be better, as I know the image doesnt always fill the entire ImageView depending on scale types. I'm open to any solutions, the above is only what ive tried so far.</p>