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

Extending RelativeLayout, and overriding dispatchDraw() to create a zoomable ViewGroup

If you are applying a scale factor to the drawing of your children, you also need to apply the appropriate scale factor to all of the other interactions with them — dispatching touch events, invalidates, etc. So in addition to dispatchDraw(), you will need to override and appropriate adjust the behavior of at least these … Read more