I am new comer to the android and got stuck with this concept.
I have extended FrameLayout
and added child views. My child view's onDraw
is called even without setting setWillNotDraw(false)
. Then what is the actual need of it and when this flag should be set.
setWillNotDraw
is not required in a View
class.
However, it is usually set to true
in a ViewGroup
. Therefore, is disables the onDraw
method there.
If you need the onDraw
method to be called inside a ViewGroup
, you just set the flag to false
like so: setWillNotDraw(false)
.
Also, if you don't want that onDraw
in your view's subclass to be called, you have to call subclassInstance.setWillNotDraw(true)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With