当前位置: 首页 > news >正文

南京代做网站制作/大数据营销

南京代做网站制作,大数据营销,做网站的公司是接入商吗,上海高端网站建设高端网站建设今天是实现了一个小功能的东西。看看效果图:实现方式:1.自己定义ScrollView 复写onScrollChange方法,来计算滑动的位置。2.自己定义接口,通过接口来在ScrollView中控制,滑动的高度的进度。3.在自己定义View中去运行动…
今天是实现了一个小功能的东西。看看效果图:
123.gif

实现方式:
1.自己定义ScrollView   复写onScrollChange方法,来计算滑动的位置。
2.自己定义接口,通过接口来在ScrollView中控制,滑动的高度的进度。
3.在自己定义View中去运行动画。



代码实现:
1.ScrollView   最基本的代码仅仅有计算滑动位置的代码了,事实上也是非常easy的。获取子View的个数。每次都去for循环,去计算字View的位置,以及当前ScrollView的top bottom
代码:

@Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
        int currentBottom = t + height ;
        int currentTop = t ; 
        Log.e("Slide""onScrollChange") ;
        
        for (int i = 0; i < childCount; i++) {
            View childView = contentLayout.getChildAt(i )  ;
            if (!(childView  instanceof EasySlideInter)) {
                continue ; 
            }
            int childTop = childView.getTop() ; 
            int childBottom = childView.getBottom() ;
            int childHeight = childView.getHeight() ; 
            EasySlideInter inter = (EasySlideInter) childView ; 
            if ( currentTop > childTop && currentTop < childBottom ) {
                inter.contentSlide(countProgress(currentTop, childBottom, childHeight)); 
            }else if (currentBottom > childTop && currentBottom < childBottom ) {
                inter.contentSlide(100 - countProgress(currentBottom, childBottom, childHeight)); 
            }else if(childTop >= currentTop && childBottom <= currentBottom){
                inter.resetContent();
            }
        }
}  


通过childView的top位置与ScrollView的当前的top位置来推断是哪个子View正在慢慢的出现,计算出progress 传递给子View中去。

事实上终于要的代码就是这么一段,动画的运行都在子View的接口方法中去做的。
我贴上一个子View的实现:
    
    @Override
    public void contentSlide(int progress) {
        textAnimator.setCurrentPlayTime(progress);
        backAnimator.setCurrentPlayTime(progress);
    }
    @Override
    public void resetContent() {
        textAnimator.setCurrentPlayTime(100);
        backAnimator.setCurrentPlayTime(100);
    }
    
    
    private void initAnimation(){
        textAnimator = ObjectAnimator.ofInt(text"textColor", Color.BLUE , Color.RED); 
        textAnimator.setEvaluator(new ArgbEvaluator());
        textAnimator.setDuration(100)  ;
        textAnimator.setInterpolator(new LinearInterpolator()) ;
        
        backAnimator = ObjectAnimator.ofInt(this"backgroundColor", Color.BLACK , Color.BLUE , Color.BLACK); 
        backAnimator.setEvaluator(new ArgbEvaluator());
        backAnimator.setDuration(100)  ;
        backAnimator.setInterpolator(new LinearInterpolator()) ;
        
    }  
实现两个接口的方法,在这两个方法中,去控制动画的进度。
非常easy的,不再累赘叙述了。
源代码下载:
百度网盘:  http://pan.baidu.com/s/1dDtVzSt 

github地址 : https://github.com/flyme2012/EasySlide 

转载于:https://www.cnblogs.com/yutingliuyl/p/6795638.html

http://www.lbrq.cn/news/1272673.html

相关文章:

  • 济南j建设网/正规seo大概多少钱
  • 如何建设网站挣钱/谷歌sem和seo区别
  • 做ktv网站大概多少钱/培训网登录入口
  • 做移动网站优化排/小红书搜索指数
  • 深圳网站优化服务/百度链接
  • 国外做二手服装网站/自媒体发布平台
  • 网站域名备案要多久/站长统计app进入网址新版小猪
  • 全案品牌策划公司/网站优化外包多少钱
  • 移动app设计网站建设/qq刷赞网站推广快速
  • 网站我们只做av的搬运工/网站建设策划书范文
  • 廊坊做网站的哪最多/seo手机端优化
  • 模板网站 优帮云/东莞网站优化关键词排名
  • wap 2.0的网站/热词分析工具
  • 建设微信网站需要服务器/网站建设流程是什么
  • 东莞网站建设模板设计/河南网站seo推广
  • .net做网站用什么框架/培训学校
  • 专门做求职课程的网站/深圳seo优化排名推广
  • 网站外链建设是什么/2024年新冠疫情最新消息今天
  • 怎么看一个网站用什么语言做的/百度助手免费下载
  • 上传了源程序提示网站建设中/市场营销活动策划方案
  • 建筑企业网站有哪些/什么叫百度竞价推广
  • 网站制作要花多少钱/网站的推广方式
  • 网站配资公司网站/百度竞价开户费用
  • 吉林分销网站建设/百度榜
  • 简单网页图片/怎么快速优化关键词
  • 高端网站建设教程/知名网站
  • 山东网站建设公司/网站内容如何优化
  • 网站制作多少钱方案/整站优化 快速排名
  • 做服装行业网站/目前常用的搜索引擎有哪些
  • 网站建设分录怎么开/黄页推广平台有哪些
  • 关于人工智能AI>ML>DL>transformer及NLP的关系
  • Python科研数据可视化技术
  • k8s使用 RBAC 鉴权
  • ctfshow_web签到题
  • S7-1200 /1500 PLC 进阶技巧:组织块(OB1、OB10)理论到实战
  • AWS云安全审计终极实战指南:构建自动化安全防线