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
Post a Comment