How to send view to back ? How to control the z-order programmatically?

I realize that this has been implied in other answers, but no one posted the code. I keep the following in a utility class where I have “helper” functions for dealing with views:

public static void sendViewToBack(final View child) {
    final ViewGroup parent = (ViewGroup)child.getParent();
    if (null != parent) {
        parent.removeView(child);
        parent.addView(child, 0);
    }
}

Leave a Comment