Android: Problem with onMeasure()
Posted
by droid-test
on Stack Overflow
See other posts from Stack Overflow
or by droid-test
Published on 2010-05-13T13:03:25Z
Indexed on
2010/05/13
13:54 UTC
Read the original article
Hit count: 126
Hi
I made a custom view. If I add the view to the layout XML file and I set the height to "fill_parent" "specSize" return 0. Why?
Code:
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int measuredHeight = 90;
int specMode = MeasureSpec.getMode(heightMeasureSpec);
int specSize = MeasureSpec.getSize(MeasureSpec.getMode(heightMeasureSpec));
if(specMode != MeasureSpec.UNSPECIFIED){
measuredHeight = specSize;
}
setMeasuredDimension(60, measuredHeight);
}
Does anyone know how I can get the height of "fill_parent"?
Thanks!
© Stack Overflow or respective owner