In android bringToFront()
not working when trying to bring a view to the front of a card view. It seems that the card view always has a higher priority than other views. I try requestLayout()
plus bringToFront()
too but it doesn't work. Is there any idea on how to solve this problem? I tried to use elevation
but it does not work on android below API level 21.
view.post(() -> {
view.setVisibility(View.VISIBLE);
view.bringToFront();
view.requestLayout();
});
finally the solution was using FrameLayout. if anyone wants to load a view in front of a cardView it must put cardView in a frameLayout. without frameLayout cardView always get a higher elevation and translation in show