Git Product home page Git Product logo

builderrecycleradapter's Introduction

#RecyclerView万能适配器

##依赖 compile 'com.tianfeng:recycleradapter:1.0.0'

如果出现异常

找不到库文件

在项目根目录的build.gradle中添加

  repositories {
        jcenter()
        ...
        maven {
            url  "https://dl.bintray.com/tf27674569/maven"
        }

    }

##使用 1.加载网络图片请调用函数

EAdapter.setImageLoader(new ImageLoader() {
            @Override
            public void displayImage(Context context, ImageView imageView, String url) {
                // 此处是你使用的库文件
            }
        });

2.适配器的使用

EAdapter.Builder.load(strings)
                .item(R.layout.activity_main)
                .bind()
                .onItemClick()
                .onItemLongClick()
                .item(View)
                .manager()
                .support()
                .into();

3.注意

 // 存在View 以贴膜为准
        if (P.mItemView != null) {
            return new ViewHolder(P.mRecyclerView.getContext(),P.mItemView);
        }

        // 存在多布局时 以多布局为准
        if (P.mSupport != null) {
            View itemView = LayoutInflater.from(P.mRecyclerView.getContext()).inflate(viewType, parent, false);
            return new ViewHolder(P.mRecyclerView.getContext(),itemView);
        }

        if (P.mLayoutId != -1) {
            View itemView = LayoutInflater.from(P.mRecyclerView.getContext()).inflate(P.mLayoutId, parent, false);
            return new ViewHolder(P.mRecyclerView.getContext(),itemView);
        }

        throw new NullPointerException("您是否设置了item的布局");

存在此判断 参数顺序会以 view support layoutid的顺序

builderrecycleradapter's People

Contributors

fengtian1 avatar

Watchers

James Cloos 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.