set RecyclerView FooterView - Android User Interface

Android examples for User Interface:RecyclerView

Description

set RecyclerView FooterView

Demo Code


import android.support.v7.widget.RecyclerView;
import android.view.View;

public class Main{
    //from   w  w w  .  jav a  2  s.  c o m
    public static void setFooterView(RecyclerView recyclerView, View view) {
        RecyclerView.Adapter outerAdapter = recyclerView.getAdapter();

        if (outerAdapter == null
                || !(outerAdapter instanceof MTFRecyclerViewAdapterWrapper)) {
            return;
        }

        MTFRecyclerViewAdapterWrapper headerAndFooterAdapter = (MTFRecyclerViewAdapterWrapper) outerAdapter;
        if (headerAndFooterAdapter.getFooterViewsCount() == 0) {
            headerAndFooterAdapter.addFooterView(view);
        }
    }
}

Related Tutorials