public static int getOrientation ( RecyclerView view ) { LayoutManager layout = view . getLayoutManager ( ) ; if ( layout instanceof LinearLayoutManager ) { return ( ( LinearLayoutManager ) layout ) . getOrientation ( ) ; } else if ( layout instanceof StaggeredGridLayoutManager ) { return ( ( StaggeredGridLayoutManager ) layout ) . getOrientation ( ) ; } return - 1 ; }
Get the orientation of the RecyclerView s LayoutManager .