Git Product home page Git Product logo

horizontalloopview's Introduction

HorizontalLoopView

水平的无限滑动的选择View,绝不会OOM哦。先看截图

版本

使用

像使用RecyclerView那样使用

setp1

repositories {
		...
		maven { url 'https://jitpack.io' }
	}

step2

dependencies {
        compile 'com.github.aohanyao:HorizontalLoopView:v1.0.0'
}

step3

 <com.aohanyao.loop.widget.HorizontalLoopView
        android:id="@+id/hlv1"
        android:layout_width="match_parent"
        android:layout_height="80dp"/>

step4

 HorizontalLoopView  hlv1 = (HorizontalLoopView) findViewById(R.id.hlv1);
 //LoopViewAdapter支持泛型,只要是view的子类即可
 hlv1.setLoopViewAdapter(new LoopViewAdapter() {
        @Override
        protected int setCenterIndex() {
            //你要默认居中的下标
            return 0;
        }

        @Override
        public int getChildWidth() {
            //每个view的宽度 单位是px
            return 0;
        }

        @Override
        public int getItemCount() {
            //数量
            return 0;
        }

        @Override
        public View getView(int position, boolean isCenter) {
            //根据下标返回相应的view ,  isCenter 为true,返回中间的view,可以做一些其他的样式
            return null;
        }

        @Override
        public void setData(View scrollView, int position) {
            //根据下标 对对应的View 做相应的数据处理
        }

        @Override
        public void onSelect(View selectView, int position) {
            //当数据选中的时候回调
        }
    });

具体请直接看demo

###求关注 微信求关注

AndroidRookie

QQ群求加入 现在只有我一个人

【Android Rookie:372734598】

horizontalloopview's People

Contributors

aohanyao avatar

Watchers

 avatar

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.