Skip to content Skip to sidebar Skip to footer

Behavior Of Setwillnotdraw(false)

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 setWillNotDr

Solution 1:

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)

Post a Comment for "Behavior Of Setwillnotdraw(false)"