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

软件工具
0 1245
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?) {
                }
            })
        }


精选帖子
Android 可可影视 v3.3.6无广告纯净版 3376
Android QQ音乐 v11.3.7 定制版解锁免费听歌无广告版 3934
Android 草图大师SKP v1.5 解锁会员版 9253
Android OmoFun追漫神器 v4.2.1 无广告绿色版 6276
AdobeGenP Adobe全家桶系列激活工具 v3.5.0/3.4.14.1 绿色版 6855
Android 七猫免费听书 v1.4 解锁高级版 5252
超良心的抢票神器——Bypass1.16 4996
Android 玲珑加速器 v6.10.9.40 解锁无限时间 3628
Android 大师兄影视 v3.3.8 去广告会员版 2764
热门帖子
微信解封技术,好友转人脸3种方法 66
一部手机日入500+,微信小程序掘金计划,四种收入来源,长期稳定可靠 60
普通人也能玩转AI量化:不盯盘,不熬夜,一套智投EA让策略自动跑 60
微信阅读AI新玩法,日做10分钟,单号100+,0成本可批量放大,附脚本 48
大众点评分成全网独家玩法,AI 全自动出内容,2 分钟一条,小白可冲单日四位数 48
一部手机就能操作,每天十几分钟就够用了,前期每天两百左右,稳定后轻松日入500+ 47
普通人的 AI 副业机会,日入300+新手小白也能起步, 47
京东ACQ是什么?闲置电脑挂机采集项目拆解 46
机器人全程负责客服接待和发货,轻资产多多虚拟,学完月入 1-5W 44