difficulty using AttributeSet.getAttributeIntValue()
<p>My app needs the height and width of the extended ImageView. I thought this should work:</p>

<pre><code>package my.android.test;

public class TestImageView extends ImageView
{
    private int mWidth=0;
    private int mHeight=0;

    public TestImageView(Context context, AttributeSet as)
    {
        super(context, as);
        final String xmlns="http://schemas.android.com/apk/res/android";
        mWidth = as.getAttributeIntValue(xmlns, "layout_width", 0);
        mHeight = as.getAttributeIntValue(xmlns, "layout_height", 0);
    }

    @Override
    protected void onDraw(Canvas canvas)
    {
        //do stuff
    }
}
</code></pre>

<p>but it doesn't work. 0 is returned by getAttributeIntValue() eventhough the layout_height is defined in the layout XML:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;

&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:fillViewport="true"
          android:background="#fffcb95a"

&lt;LinearLayout android:orientation="vertical"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"

&lt;FrameLayout android:layout_width="fill_parent"
             android:layout_height="wrap_content"

    &lt;RelativeLayout android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:padding="6dip"

        &lt;my.android.test.TestImageView
                    android:id="@+id/TestImageViewID" 
                    android:layout_width="100dip"
                    android:layout_height="100dip"
                    android:src="@drawable/icon"
                    android:scaleType="centerCrop" /&gt;

    &lt;/RelativeLayout

&lt;/FrameLayout

&lt;/LinearLayout
&lt;/ScrollView
</code></pre>

<p>what to do ?</p>
