AndroidPieChart icon indicating copy to clipboard operation
AndroidPieChart copied to clipboard

onConfigurationChanged to Landscape MeasureSpec.getSize(widthMeasureSpec) returns 0 in onMeasure

Open samleighton87 opened this issue 11 years ago • 0 comments

When the configuration is changed, onMeasure is called twice. This is something to do with the Android lifecylce that I do not fully understand. The first time MeasureSpec.getSize(widthMeasureSpec) in my Landscape orientation returns 0 and the second it returns the true value. It does not do this in the portrait view - again I am not sure why. Anyway the upshot of this is that the rectangle size is set to 0 in the landscape orientation but works fine in the portrait. To get round this I have added a (slightly hacky) if (MeasureSpec.getSize(widthMeasureSpec) != 0) check prior to the rectangle being drawn so that in the landscape it take the second true value of MeasureSpec.getSize(widthMeasureSpec) to draw the rectangle r for the chart rather than 0.

samleighton87 avatar Mar 24 '14 19:03 samleighton87