How to bring view in front of everything?

后端 未结 16 2224
刺人心
刺人心 2020-11-30 01:31

I have activity and a lot of widgets on it, some of them have animations and because of the animations some of the widgets are moving (translating) one over another. For exa

16条回答
  •  野性不改
    2020-11-30 02:17

    There can be another way which saves the day. Just init a new Dialog with desired layout and just show it. I need it for showing a loadingView over a DialogFragment and this was the only way I succeed.

    Dialog topDialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
    topDialog.setContentView(R.layout.dialog_top);
    topDialog.show();
    

    bringToFront() might not work in some cases like mine. But content of dialog_top layout must override anything on the ui layer. But anyway, this is an ugly workaround.

提交回复
热议问题