Giter Club home page Giter Club logo

lib-recycleview's Introduction

依赖

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    implementation 'com.github.alanplus:lib-recycleview:0.9.1'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

使用

  • 简单用法
class Test{
    
    public static void main(String[] args){
      XmRecycleView recycleView = findViewById(R.id.view);
      helper = new SimpleListHelper<>(recycleView);
      helper.setData(list);
      helper.setOnRefreshListener(new OnRefreshListener() {
          @Override
          public void onRefresh(@NonNull RefreshLayout refreshLayout) {
              position = 0;
              loadData();
          }
      });
      
      helper.setOnLoadMoreListener(new OnLoadMoreListener() {
          @Override
          public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
              loadData();
          }
      });
      
      helper.setIBaseRecycleView(new IBaseRecycleView<String>() {
          @Override
          public View getView(Context context, int type) {
              TextView textView = new TextView(context);
              int i = SmartUtil.dp2px(10);
              textView.setPadding(i, i, i, i);
              textView.setBackgroundColor(Color.WHITE);
              textView.setLayoutParams(new RecyclerView.LayoutParams(-1, -2));
              return textView;
          }
      
          @Override
          public void bindView(String s, View view, int position) {
              if (view instanceof TextView) {
                  ((TextView) view).setText(s);
              }
          }
      });
      
      helper.build();
      helper.autoRefresh();
    }
    
    
}


lib-recycleview's People

Contributors

alanplus-i 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.