Lazy Loading recyclerView in android

前端 未结 2 1561
暖寄归人
暖寄归人 2020-12-30 09:33

Does anyone know how to implement Lazy Loading recyclerView in android?I\'m pretty new to android and I don\'t know how to figure this out.I\'ll be thankful if anyone helps.

2条回答
  •  一个人的身影
    2020-12-30 10:10

    I think this is better because you don't need a specific version of minsdk

    step 1: create interface

    interface caller{
    void call();
    }
    

    step 2: create caller on your RecycleView

    step 3: check is a last item? how ?

    in you Recyclerview on onBindViewHolder

    if (position==items.size()-1){// its a last item
               callbacker.call();
    }
    

    step 4: on your activity that create your recycler view define and
    pass to your recycler view constructor

    callbacker call{
    recyclerParamerList.addAll(ItemList items());
    youradapter.notifyDataSetChanged();
    }
    

提交回复
热议问题