GridViewPager

PDF for offline use
Sample Code:
Related SDKs:

Let us know how you feel about this

Translation Quality


0/250

The GridViewPager sample demonstrates how to implement the 2D picker navigation pattern for Android Wear.

First add the Xamarin Android Wear Support NuGet package to your project.

The layout XML looks like this:

<android.support.wearable.view.GridViewPager xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:keepScreenOn="true" />

Create a GridPagerAdapter (or subclass such as FragmentGridPagerAdapter to supply views to display as the user navigates.

The sample adapter shows how to implement the required methods, including overrides for RowCount, GetColumnCount, GetBackground, and GetFragment

Wire up the adapter as shown:

pager.Adapter = new SimpleGridPagerAdapter (this, FragmentManager);

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.