SHARE
TWEET

Untitled

a guest Oct 17th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. override fun getItemOffsets(outRect: Rect, view: View,
  2.                                 recyclerView: RecyclerView,
  3.                                 state: RecyclerView.State) {
  4.  
  5.         super.getItemOffsets(outRect, view, recyclerView, state)
  6.  
  7.         when (isLastItem(recyclerView, view)) {
  8.             true -> outRect.set(Rect(0, 0, 0, 120))
  9.             else -> outRect.set(Rect(0, 0, 0, 0))
  10.         }
  11.     }
  12.  
  13.     private fun isLastItem(recyclerView: RecyclerView, view: View): Boolean {
  14.         val lastItemPos = recyclerView.getChildAdapterPosition(view)
  15.         return lastItemPos == recyclerView.adapter!!.itemCount - 1
  16.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top