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

软件工具
0 1176
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无广告纯净版 3038
Android QQ音乐 v11.3.7 定制版解锁免费听歌无广告版 3615
Android 草图大师SKP v1.5 解锁会员版 8979
Android OmoFun追漫神器 v4.2.1 无广告绿色版 6012
AdobeGenP Adobe全家桶系列激活工具 v3.5.0/3.4.14.1 绿色版 6591
Android 七猫免费听书 v1.4 解锁高级版 5015
超良心的抢票神器——Bypass1.16 4745
Android 玲珑加速器 v6.10.9.40 解锁无限时间 3395
Android 大师兄影视 v3.3.8 去广告会员版 2516
热门帖子
从写脚本到接大单:这套AI广告课,让你在家就能跑通整个生意【原创双语字幕】 55
AI漫剧短剧进阶课|电脑+手机双端实操教学|影视剧对口型人物吃瓜×解压末日庇护所全程讲解,高阶技巧全掌握 54
Suno AI零基础音乐创作课:账号准备→界面解析→一键成曲→自定义模式,快速上手AI作曲 50
Codex从入门到实战完整课|充值·安装·接入DeepSeek,记忆·插件·Skill·CLI·MCP全拆解 40
Codex自媒体IP系统课:IP诊断/热点抓取/IP蒸馏 Skill,爆款复刻数字人多平台自动发布教程 39
漫画学Python·办公自动化全实战:Excel/Word/PPT/PDF/邮件/爬虫一网打尽 38
2026Codex 智能体实战课:工具配置精讲|提示词优化技巧|AI 技能封装|全场景自动化落地教程 35
AI编程 Claude Code快速入门到精通:功能×命令×核心模式×工作流×Skill搭建×插件开发全技能 35
番茄小说达人零门槛副业,不用创作基础,轻松日入500+,碎片化时间稳定增收 33