GithubHelp home page GithubHelp logo

keeptrain-master's Introduction

0、博客地址

https://editor.csdn.net/md/?articleId=106413991

1、概述

keep 的运动统计界面,滑动的柱状图很炫酷。想着怎么实现

在这里插入图片描述

2、模仿效果

在这里插入图片描述

在这里插入图片描述

3、实现思路

多操作几遍,感觉keep的效果就是一个横向的picker,及:横向滑动,自动选择中间一项,点击item也可以自动滚动该item(这个只是锦上添花)。

就按横向picker进行思考,google 了一些实现。发现用recycleView其实是很方便做横向 picker的。参考:添加链接描述

3.1、值得提的点

  • SnapHelper 可以自动滚动一个item,实现吸合效果

其他都是顺其自然的点:

  • RecyclerView 可以右向左滑动
  • RecyclerView 的横向加载更多(现在取临界点是利用picker取的)

4、补充

RecyclerView 的横向加载更多在使用 layoutManager.findLastVisibleItemPosition() 方法时返回的都是 -1,所以舍弃了这种方式,还没深入了解为什么只竖向有效横向无效

LinearLayoutManager layoutManager = ((LinearLayoutManager)recyclerView.getLayoutManager());
   recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            // super.onScrolled(recyclerView, dx, dy);
            int lastVisiblePosition = layoutManager.findLastVisibleItemPosition();
            if (lastVisiblePosition == recyclerView.getChildCount()) {
                if (loadmore) {
                    loadmore = false;
                   method();
                }
            }
        }
    });

keeptrain-master's People

Watchers

James Cloos avatar  avatar

Forkers

androidlu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.