I need to find a view by id and then override its onMeasure
method. Does anyone know how to do that?
The following will not work in Java, but conceptually it's what I need:
ImageView myImage = (ImageView) findViewById(R.id.some_pic);
myImage.onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
showOther(width, height);
};
myImage.setImageBitmap(bmp);
Java offers this
ImageView myImage = new ImageView(this) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
showOther(width, height); }
};
or this
ImageView myImage. = (ImageView) findViewById(R.id.some_pic);
myImage.setImageBitmap(bmp);
I thought of using setOnMeasureListener
but no such method is defined for ImageView. Any thoughts on how to get this going?