Indeed, bringToFront() does not help; it just changes the order of the children in its parent child array, but it does not change the playback order of the children.
If you use API-21 or higher, you can simply change the Z value of the view ( view.setZ(..) ) to bring it to the forefront.
Below API-21 there is a callback you can use: RecyclerView.ChildDrawingOrderCallback . With it, you can determine in which order the children should be displayed. (You can also use this with API-21 + if you don't like the extra shadow you get by changing the Z value.)
Example:
final int indexOfFrontChild = rv.indexOfChild(desiredFrontView); rv.setChildDrawingOrderCallback(new RecyclerView.ChildDrawingOrderCallback() { private int nextChildIndexToRender; @Override public int onGetChildDrawingOrder(int childCount, int iteration) { if (iteration == childCount - 1) { // in the last iteration return the index of the child // we want to bring to front (and reset nextChildIndexToRender) nextChildIndexToRender = 0; return indexOfFrontChild; } else { if (nextChildIndexToRender == indexOfFrontChild) { // skip this index; we will render it during last iteration nextChildIndexToRender++; } return nextChildIndexToRender++; } } }); rv.invalidate();
Basically, onGetChildDrawingOrder(...) will be called childCount times, and in each iteration we can specify which child object should be displayed (returning its index).
source share