android - How to add recycler view or card view in fragments? -


i have created recyclerview , cardview in android. want add 1 of 3 fragments displayed on clicking respective tabs navigation drawer.so how add in fragment.

can me out so. thank much!

first add support v7 library in project in xml file put this.

  <android.support.v7.widget.recyclerview         android:id="@+id/my_recycler_view"         android:layout_width="match_parent"         android:layout_height="match_parent">      </android.support.v7.widget.recyclerview> 

then in fragment put these lines.

scheduler_day_view_horizontal_recyclerview = (recyclerview) v.findviewbyid(r.id.my_recycler_view);     layoutmanager = new linearlayoutmanager(context, linearlayoutmanager.horizontal, false);     scheduler_day_view_horizontal_recyclerview.setlayoutmanager(layoutmanager);     scheduler_day_view_horizontal_recyclerview.setitemanimator(new defaultitemanimator());     scheduler_day_view_horizontal_recyclerview.sethasfixedsize(true); 

then set adapter recyclerview.

for more detail cardview , recycler view please visit here


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -