關於Android WindowManager顯示懸浮窗的動畫效果


要實現WindowManager添加的窗口,實現動畫顯示,就需要添加如下紅色的屬性,其他的添加View只要設置其Animations屬性也會實現動畫,當然自己實現也可,但是能直接用系統的已經實現好的,也很方便。

windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); 
WindowParams = new LayoutParams(LayoutParams.FLAG_FULLSCREEN,LayoutParams.FLAG_FULLSCREEN); WindowParams.type=LayoutParams.TYPE_SYSTEM_ERROR; WindowParams.flags=LayoutParams.FLAG_ALT_FOCUSABLE_IM; //window gets focus WindowParams.format=PixelFormat.TRANSPARENT; //set the opacity to 100% WindowParams.windowAnimations=android.R.style.Animation_Translucent; // set the animation for the window WindowParams.gravity = Gravity.RIGHT | Gravity.TOP; windowManager.addView(view, WindowParams);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM