how to make animation for popup window in android

后端 未结 4 1440
挽巷
挽巷 2020-12-23 19:26

I hava a popup window in my application, its appears when some button clicked I want to set fade in animation to this window, I put the xml file in \"res/anim\" folder and s

4条回答
  •  星月不相逢
    2020-12-23 20:13

    This might be a bit late but the reason why the animation did not show is because you are showing the popupwindow before you set up your animation.

    optionspu.showAtLocation(layout, Gravity.TOP, 0, 0);
    optionspu.setAnimationStyle(R.anim.myanim);
    

    Reverse the two lines and you will see the animation:

    optionspu.setAnimationStyle(R.anim.myanim);
    optionspu.showAtLocation(layout, Gravity.TOP, 0, 0);
    

提交回复
热议问题