How can I fill RecyclerView with GridLayoutManager from right to left

Create a class that extends GridLayoutMAnager ,and override the isLayoutRTL() method like this:

public class RtlGridLayoutManager extends GridLayoutManager {

    public RtlGridLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    public RtlGridLayoutManager(Context context, int spanCount) {
        super(context, spanCount);
    }

    public RtlGridLayoutManager(Context context, int spanCount, int orientation, boolean reverseLayout) {
        super(context, spanCount, orientation, reverseLayout);
    }

    @Override
    protected boolean isLayoutRTL(){
        return true;
    }
}

The answer by Mohammad is true but you do not need to create a new class. you can simply override isLayoutRTL method.

GridLayoutManager lm = new GridLayoutManager(this, 2) {
    @Override
    protected boolean isLayoutRTL() {
        return true;
    }
};