How to bring view in front of everything?

后端 未结 16 2191
刺人心
刺人心 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 01:57

    i have faced the same problem. the following solution have worked for me.

     FrameLayout glFrame=(FrameLayout) findViewById(R.id.animatedView);
            glFrame.addView(yourView);
            glFrame.bringToFront();
            glFrame.invalidate();
    

    2nd solution is by using xml adding this attribute to the view xml

    android:translationZ=""
    

提交回复
热议问题