0

I created a custom view in which I want to draw a series of squares, the side of the square depends on the dimensions that are assigned to the view, so in my method onMeasure() after checking mode and size, I call setMeasuredDimension (width, height). Now it is correct to perform operations after setMeasuredDimension like

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    /*******/
    setMeasuredDimension(width,height);
    squareSize = width / rows;
}
JayJona
  • 469
  • 1
  • 16
  • 41
  • 1
    When the only thing needed is a views final width and height, we usually use onSizeChanged method for that. – Nezih Yılmaz Aug 17 '19 at 05:08
  • Even views width and height params are available also in onMeasure and will do the job, that method is overriden mostly for manipulating the actual measuring process of the view – Nezih Yılmaz Aug 17 '19 at 05:10

0 Answers0