ImageView myImage = findViewById(R.id.myImage); int width = myImage.getMeasuredWidth(); Log.d("ImageView", "Width of image is: " + width);
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = getMeasuredWidth(); int height = getMeasuredHeight(); Log.d("ImageView", "Width is: " + width); Log.d("ImageView", "Height is: " + height); }In this example, we are overriding the `onMeasure` method to obtain the measured width and height of the ImageView and displaying it in a log message. The `android.widget.ImageView` class belongs to the `android.widget` package library.