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

软件工具
0 1129
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无广告纯净版 2929
Android QQ音乐 v11.3.7 定制版解锁免费听歌无广告版 3495
Android 草图大师SKP v1.5 解锁会员版 8833
Android OmoFun追漫神器 v4.2.1 无广告绿色版 5896
AdobeGenP Adobe全家桶系列激活工具 v3.5.0/3.4.14.1 绿色版 6474
Android 七猫免费听书 v1.4 解锁高级版 4909
超良心的抢票神器——Bypass1.16 4627
Android 玲珑加速器 v6.10.9.40 解锁无限时间 3279
Android 大师兄影视 v3.3.8 去广告会员版 2404
热门帖子
3个月收入25003元,长期稳定Ai任务,新手3天入门 全民可做! 56
全流程AI托管,当天做当天出单,单账号轻松日入500+,小白轻松上手 45
卡通知识科普短视频教学|小白轻松上手,打造高赞内容,稳定拿平台收益 44
拼多多虚拟类目懒人经济新玩法,无需人工值守,机器人自动发货月入 1-5W 44
超强大的AI工具,免费无限制,一键生成原创中视频,单号日入1000+,小白秒上手 43
连电脑都不太会用?AI美女视频课专治小白,1小时从安装到出片,门槛低到没朋友 43
从流量到变现|百万博主实战,一人公司搭建,轻资产放大商业价值 40
OiiOii一键式动画创作:漫画转视频+动漫音乐MV+剧情故事短片全流程实战 39
红果免费短剧 v7.2.1.33 网络短剧观看APP 纯净优化版 38