Loop through all subviews of an Android view?

I have made a small example of a recursive function: public void recursiveLoopChildren(ViewGroup parent) { for (int i = 0; i < parent.getChildCount(); i++) { final View child = parent.getChildAt(i); if (child instanceof ViewGroup) { recursiveLoopChildren((ViewGroup) child); // DO SOMETHING WITH VIEWGROUP, AFTER CHILDREN HAS BEEN LOOPED } else { if (child != null) { … Read more

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 … Read more