Android Custom Layout – onDraw() never gets called

By default, onDraw() isn’t called for ViewGroup objects. Instead, you can override dispatchDraw().

Alternatively, you can enable ViewGroup drawing by calling setWillNotDraw(false) in your TableView constructor.

EDIT:

For #2:
– Initialize it in the constructor, then just call rect.set() in your onLayout() method.

For #3:
– Yes, as far as I’m aware the super call will handle it, you shouldn’t have to handle that unless you need to customize the way the children are drawn.

Leave a Comment