简体   繁体   中英

android bring to front not working on card view

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM