remove RecyclerView FooterView - Android User Interface

Android examples for User Interface:RecyclerView

Description

remove RecyclerView FooterView

Demo Code


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

public class Main{
    //from  w  ww  .j a v  a 2  s  .  co m
    public static void removeFooterView(RecyclerView recyclerView) {

        RecyclerView.Adapter outerAdapter = recyclerView.getAdapter();

        if (outerAdapter != null
                && outerAdapter instanceof MTFRecyclerViewAdapterWrapper) {

            int footerViewCounter = ((MTFRecyclerViewAdapterWrapper) outerAdapter)
                    .getFooterViewsCount();
            if (footerViewCounter > 0) {
                View footerView = ((MTFRecyclerViewAdapterWrapper) outerAdapter)
                        .getFooterView();
                ((MTFRecyclerViewAdapterWrapper) outerAdapter)
                        .removeFooterView(footerView);
            }
        }
    }
}

Related Tutorials