短视频程序源码,简单布局收缩动画

软件工具
0 159
private fun showOrhide(
//收缩部分
        linearLayout: LinearLayout,
        //旋转箭头
        taskDetailArrow: RelativeLayout
    ) {
        val scrollView = binding.scrollView
        val rect = Rect()
        linearLayout.getGlobalVisibleRect(rect)
        val arrow = taskDetailArrow.getChildAt(1)
        if (linearLayout.visibility == View.VISIBLE) {
            arrow.rotation = 180f
            ObjectAnimator.ofFloat(
                linearLayout,
                "translationY",
                0.0f, -linearLayout.measuredHeight.toFloat()
            ).apply {
                duration = 500
                interpolator = AccelerateInterpolator()
                start()
            }.addListener(object : Animator.AnimatorListener {
                override fun onAnimationRepeat(animation: Animator?) {
                }
 
                override fun onAnimationEnd(animation: Animator?) {
                    linearLayout.visibility = View.GONE
                    scrollView.post {
                        scrollView.smoothScrollTo(0, rect.bottom);
                    }
                }
 
                override fun onAnimationCancel(animation: Animator?) {
                }
 
                override fun onAnimationStart(animation: Animator?) {
 
                }
            })
 
        } else {
            arrow.rotation = 0f
            ObjectAnimator.ofFloat(
                linearLayout,
                "translationY",
                -linearLayout.measuredHeight.toFloat(), 0.0f
            ).apply {
                duration = 500
                interpolator = AccelerateInterpolator()
                start()
            }.addListener(object : Animator.AnimatorListener {
                override fun onAnimationRepeat(animation: Animator?) {
                }
 
                override fun onAnimationEnd(animation: Animator?) {
                    linearLayout.visibility = View.VISIBLE
                    scrollView.post {
                        scrollView.smoothScrollTo(0, rect.bottom);
                    }
                }
 
                override fun onAnimationCancel(animation: Animator?) {
                }
 
                override fun onAnimationStart(animation: Animator?) {
                }
            })
        }


短视频程序源码,简单布局收缩动画-小师傅资源网--http://bbs.small-master.com/2447.html
精选帖子
2021《人潮汹涌》电影资源TC清晰版在线看 207
你好,李焕英(TC版) 571
唐人街探案3(TC版) 279
十万人搭建支付暗道:跑分模式兴起,为赌博和洗钱提供百亿资金 426
庆余年电视剧提前观看全集 492
蚂蚁任务辅助平台怎么样?微信辅助10元~12.5元一单 604
uTools 一款极简插件化跨平台的现代桌面工具软件 657
我和我的祖国——2019国庆三部曲其三 557
攀登者——2019国庆三部曲其二 498
热门帖子