To prevent points from moving with the page, place them in the action layout instead of individual fragments of the page. For instance:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.wearable.view.GridViewPager android:id="@+id/grid" android:layout_width="match_parent" android:layout_height="match_parent" /> <LinearLayout android:id="@+id/page_dots_container" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" /> </RelativeLayout>
Depending on your particular application, you can either fill out the page_dots_container layout in XML, or program it programmatically using small ImageViews. Then set OnPageChangeListener to the GridViewPager - when the selected page changes, refresh the ImageViews point to display which page is selected.
See the JumpingJack Wear sample (under sdk / samples / android-20 / wearable / JumpingJack) for a complete example.
source share