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

软件工具
0 1090
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无广告纯净版 2794
Android QQ音乐 v11.3.7 定制版解锁免费听歌无广告版 3327
Android 草图大师SKP v1.5 解锁会员版 8694
Android OmoFun追漫神器 v4.2.1 无广告绿色版 5733
AdobeGenP Adobe全家桶系列激活工具 v3.5.0/3.4.14.1 绿色版 6306
Android 七猫免费听书 v1.4 解锁高级版 4755
超良心的抢票神器——Bypass1.16 4438
Android 玲珑加速器 v6.10.9.40 解锁无限时间 3123
Android 大师兄影视 v3.3.8 去广告会员版 2240
热门帖子
Doomer小剧场视频教学,某大V精选教学,精选独家分成收益 79
AI一键对口型唱歌教程:零基础也能学,素材准备+模型训练+音色转换,轻松做爆款唱歌视频 73
人物声音实时变声软件教学:全设备适配+多场景实操,零基础极速搭建个性化声音 70
微信小程序掘金,每天半小时,轻松月入1W+ 62
迅雷11精简绿色版 不限速去广告解锁SVIP加速安装版 58
26年最新海外Tk醒图拉新,蓝海项目,会手机剪辑就可以做,月入20000+ 55
公众号流量主系统变现教程:从0到1打造持续变现的流量账号,小白也能突破10W+文章 53
七猫免费小说去广告解锁会员免费版 手机看小说软件安卓APP 43
ifixit万能维修教程APP软件 多种电子数码与家电品类的维修教程 42