Search code examples
javaandroideclipseandroid-layoutgoogle-gdk

How to create a glass card with custom view\layout?


Is there any way to create a glass Live card with a custom layout?

Any equivalent to Activity's setContentView(layoutId)?

Do I create a special xml file or is it the same as with regular Android Views or Popup Views?


Solution

  • There're two ways to rendering content on a live card, as documented at https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/timeline/LiveCard

    Elad's way is the first, and what you want - "Inflating a layout using remote views". The live card so created is called low-frequency live card.

    The other way is drawing directly on a live card surface, using for example Canvas API. The live card so created is called high-frequency live card.

    https://developers.google.com/glass/develop/gdk/ui/live-cards has some further doc explaining and sample code showing how to create the two types of live cards.