Android Popup isClippingEnabled减慢动画速度

问题描述

我对弹出窗口有疑问。我想创建两个不同的弹出窗口,一个作为真正的弹出窗口,另一个仅用于使屏幕变暗。一切正常,但是当我尝试将暗淡弹出框拉伸到状态栏时(用 fadePopup.isClippingEnabled = false 行),动画不再平滑,它会在短时间后开始播放一些甚至无法播放的设备。 我的错是什么,我该如何解决


这是我的弹出式Kotlin代码

window.location.href

这是动画的样式文件

private fun onButtonShowPopupWindowClick(view:View) {
        // inflate the layout of the popup window
        val inflater = context?.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater?
        val popupView = inflater?.inflate(R.layout.popup_resend_email,null)

        // create the popup window
        val width = LinearLayout.LayoutParams.WRAP_CONTENT
        val height = LinearLayout.LayoutParams.WRAP_CONTENT
        val focusable = true // lets taps outside the popup also dismiss it
        val popupWindow = PopupWindow(popupView,width,height,focusable)
        popupWindow.animationStyle = R.style.popup_window_animation

        // show the popup window
        val layout = inflater?.inflate(R.layout.popup_translucent_dummy,null)

        //second popup for dim effect
        val fadePopup = PopupWindow(layout,10000,false)
        fadePopup.isClippingEnabled = false
        fadePopup.animationStyle = R.style.popup_window_dim_animation
        fadePopup.showAtLocation(layout,Gravity.NO_GraviTY,0)
        fadePopup.contentView.post {popupWindow.showAtLocation(view,Gravity.CENTER,0); animateStatusBar(false)}

        popupWindow.setondismissListener {
            fadePopup.dismiss()
        }
        // dismiss the popup windows when touched
        popupWindow.contentView.findViewById<AppCompatButton>(R.id.closeButton).setonClickListener{popupWindow.dismiss()}
    }

这是其中的动画文件 popup_dim_in_anim ):

<style name="popup_window_dim_animation">
        <item name="android:windowEnteranimation">@anim/popup_dim_in_anim</item>
        <item name="android:windowExitAnimation">@anim/popup_dim_out_anim</item>
</style>

我还尝试单独为状态栏设置动画,但这没有用,我无法同步这两个动画-状态栏的行为似乎有所不同,并且对动画没有那么快...

先谢谢您!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)