In Android, there is an error that breaks View.bringToFront .
If I have views ordered in a GridView and you want to bring the view to the beginning by calling the showToFront () method, you can move it to the lower right position in the GridView.
Something shadow happens there, so I cannot use the bringToFront () method. When I do not call it, everything works fine. But overlapping views - if I use scaled animation to scale the view, it is partially hidden by the views below and to the right.
I checked the source of bringToFront and it calls parent.bringChildToFront (...)
this method
public void bringChildToFront(View child) { int index = indexOfChild(child); if (index >= 0) { removeFromArray(index); addInArray(child, mChildrenCount); child.mParent = this; } }
he apparently removes the view from himself! No mercy! Is the ViewGroup so dumb that it can't control the Z-indexes in any other way that moves the controls? Obviously, when a GridView removes its child and then adds it back, it is placed at the end of the grid!
Is there anything I can do to show a top view of others without resorting to hacking? One thing that comes to my mind is to create another view over the GridView that will seem to be taller than the one I'm trying to bring ToFront (), but I don't like this solution.
android layout view z-index viewgroup
Axarydax
source share