I am trying to add a custom layout page within cards.
Here: https://developer.android.com/training/wearables/ui/2d-picker.html
explains that CardFragment can easily add a card by:
CardFragment fragment = CardFragment.create(title, text, page.iconRes);
now if I decided I want to have a custom layout, how do I add it instead of creating a CardFragment?
Check this image:
The third page is a full screen custom layout. How can I achieve this?
FragmentGridPagerAdapter
can actually support any subclass of Fragment
that you need to use. CardFragment
is just a convenience for a standard wearable layout.
So, you can just create a custom Fragment with a simple layout (such as a full-size ImageView
) and return it for the appropriate page index.