android bring to front not working on card view

302 views Asked by At

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();
});
1

There are 1 answers

1
MohammadReza Berenji On

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