I've got a viewgroup class that I'm adding a checkbox to progammatically like this:
checkbox = new CheckBox(getContext());
RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
addView(checkbox, relativeParams);
When I call invalidate on the viewgroup, the checkbox is not drawn. However, if I put checkbox.draw() inside my view's onDraw() override, then I see the checkbox. But the checkbox is not functional, meaning clicking on it does not change it's state.
So there are two questions. First, I thought invalidating a view group would cause the view group to draw itself and it's children automatically. Second, why can't I press the checkbox and get a state change when I draw the checkbox explicitly?