static void aPutViewBehindOtherView(final View a, final View b) { androidUI(r { ViewGroup group = (ViewGroup) a.getParent(); ViewGroup group2 = (ViewGroup) a.getParent(); if (group2 != group) ret; int i1 = group.indexOfChild(a); int i2 = group.indexOfChild(b); if (i1 > i2) ret; // order ok group.removeView(a); group.removeView(b); group.addView(b, i1); group.addView(a, i2); }); }