Search code examples
google-glassgoogle-gdk

How do I create a slider in the GDK?


Programming the GDK a few weeks now, the CardScrollView is a pretty nice interface for displaying cards. However one issue with the UI is showing the user how far along they are in the card stack. In the Mirror API, this is nicely handled by the Slider view at the bottom of the screen as described on the Glass Design page:

https://developers.google.com/glass/design/style/metrics-grids

Unfortunately, I have not been able to get this Slider object to display on the CardScrollView and instead have resorted to a klugey 1 of n text.

Is there any way to get this Slider view to display in the GDK?


Solution

  • For future reference, this feature has been already implemented as described in the original issue.

    You can use the method setHorizontalScrollBarEnabled to show the bar, e.g.

    mCardScrollView.setHorizontalScrollBarEnabled(true);