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

软件工具
0 999
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无广告纯净版 2420
Android QQ音乐 v11.3.7 定制版解锁免费听歌无广告版 2888
Android 草图大师SKP v1.5 解锁会员版 8326
Android OmoFun追漫神器 v4.2.1 无广告绿色版 5306
AdobeGenP Adobe全家桶系列激活工具 v3.5.0/3.4.14.1 绿色版 5906
Android 七猫免费听书 v1.4 解锁高级版 4352
超良心的抢票神器——Bypass1.16 3980
Android 玲珑加速器 v6.10.9.40 解锁无限时间 2714
Android 大师兄影视 v3.3.8 去广告会员版 1828
热门帖子
靠 AI 写商业计划书,一单赚 3000+,给专属接单渠道,越做越稳,告别打工 225
Android 漫天星漫画 v3.2.5 去广告清爽版 213
AI漫剧全链路增效课:从小说到成片,成本、分镜、角色、配音全优化,效率提升300% 210
12306抢票软件 Bypass分流抢票 春节提高高铁火车抢票成功率 207
街机模拟器完全整合版 FB Neo 25000+街机游戏 怀旧PC单机游戏 142
即梦豆包AI绘画指令大全:海量关键词库一键复制,出图效率提升10倍,轻松日更百图 53
AI业务自动化实战课,20款AI机器人搭建,覆盖文案、播客、销售与数据分析,打造自动化业务 52
2026AI漫剧全流程变现实战:快手百万博主亲授,吃透90%分账红利,单人居家轻松月入过万 49
【公众号流量主】红利回归!AI四步法每天3分钟,实测稳定日入2000+ 44