EasyFloat icon indicating copy to clipboard operation
EasyFloat copied to clipboard

点击悬浮窗View,用ValueAnimator改变View 的高度或者宽度,出现卡顿的情况。

Open jiaowenzheng opened this issue 3 years ago • 3 comments

` private fun showActivityFloat(tag: String) { EasyFloat.with(this) .setSidePattern(SidePattern.RESULT_HORIZONTAL) .setImmersionStatusBar(true) .setGravity(Gravity.END, 0, 10) // 传入View,传入布局文件皆可,如:MyCustomView(this)、R.layout.float_custom .setLayout(MyCustomView(this)) { it.findViewById<TextView>(R.id.textView).setOnClickListener { v -> toast() heightAnimator(v) } } .show() }

private fun heightAnimator(v: View){
    val valueAnimator = ValueAnimator.ofInt(v.height,v.height + 200)
    valueAnimator.addUpdateListener {
        val params = v.layoutParams
        params.height = it.animatedValue as Int
        v.layoutParams = params
    }
    valueAnimator.start()
}

`

jiaowenzheng avatar Sep 18 '21 04:09 jiaowenzheng

运行项目的Demo,在放大View的时候也有卡顿的情况,真是奇怪了,缩小就没有

licoba avatar Oct 11 '21 11:10 licoba

怎么解决呢

wuh876 avatar Mar 14 '22 06:03 wuh876

demo中 可以增加回调间隔时间限制,以下限制 25ms回调一次 MotionEvent.ACTION_MOVE -> { if (System.currentTimeMillis() - lastUpdateTime > 25) { lastUpdateTime = System.currentTimeMillis() onScaledListener?.onScaled(event.x - touchDownX, event.y - touchDownY, event) } }

zhoukp616 avatar Aug 03 '22 08:08 zhoukp616