5

In my app, users can send an icon/gift to other users. I want to show a DialogFragment popup that includes paging of available icons.

For example, I have a total of 15 icons to display. I want to show 6 icons per page, which means i should have 3 "pages" to swipe through horizontally.

Similar pager

I tried using a FragmentPagerAdapter and RecyclerView with GridLayout for the icons. But it's not really working like i want it.

How can this be implemented using a PagerAdapter without any fragments?

TareK Khoury
  • 12,721
  • 16
  • 55
  • 78
  • So what's the problem with your solution using `FragmentPagerAdapter` and `RecyclierView` inside? – romtsn Nov 13 '16 at 15:32

3 Answers3

4

If you dont want to use fragments then try with a normal activity with a dialog theme. eg; <activity android:name="your_activity_name" android:theme="@android:style/Theme.Dialog" />

NIPHIN
  • 1,071
  • 1
  • 8
  • 16
3
  1. Create a DialogFragment with ViewPager and Pager Indicator in it (as per your design).
  2. Add a PagerAdapter for the ViewPager.
  3. Create a layout and add the RecyclerView in it.
  4. Now use that layout created in 3rd Step in PagerAdapter and inside PagerAdapter, set Adapter for recyclerview with GridLayoutManager and Horizontal Orientation and show the 6 items from your list.
Sahil Munjal
  • 463
  • 2
  • 15
0

You can use three pages each containing a RecyclerView, each page is a custom view instead of a fragment. But you still have to use the ViewPager to navigate through the pages

Mohammad Abbas
  • 245
  • 2
  • 13