android - onMeasure with wrap_content is taking parameters that are not Integer.MIN_VALUE -
in xml specified wrap_content both width , height when override onmeasure function width , height passed -2147483348 oddly 300 > integer.min_value there reason this? why not integer.min_value or 0 if didn't have inside it. btw custom view i'm making have setmeasureddimension believe.
the arguments onmeasure not available width , height, encoding of available width , height along flags how values supposed used. decode them using view.measurespec class:
protected void onmeasure(int widthspec, int heightspec) { final int widthmode = measurespec.getmode(widthspec); final int widthsize = measurespec.getsize(widthspec); // etc. } the mode 1 of at_most, exactly, or unspecified. see docs how supposed use this. in particular, if mode not unspecified must not use value greater size dimension when call setmeasureddimension.
Comments
Post a Comment