cymcsg / UltimateRecyclerView

A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.
Apache License 2.0
7.22k stars 1.43k forks source link

Access first and last card? #85

Open xaxist opened 9 years ago

xaxist commented 9 years ago

I have setup a recycler view that displays a card layout using adapter. I need to set the padding of first and last card only. Is there any way, I can access the card directly?

After setting up the adapter for recycler view, I tried to accesse the first card by using following code, but it always returns null. Any help is appreciated.

CardView cv = (CardView)recyclerView.mRecyclerView.getChildAt(0);

where recyclerView being the Instance of UltimateRecyclerView.

cymcsg commented 9 years ago

UltimateRecyclerview. mRecyclerView is geting the main recyclerview directly.

xaxist commented 9 years ago

Any idea why the card view is always null? Is it because the adapter takes some time to add the card to the recycler view? Any potential solution to access the card view after adding is appreciated. Thanks!