2

I'm a bit stuck here,

I just started with the basics of Glass development, is it possible to add a CardScrollView/Card to an Livecard?

It looks like it's only possible to add RemoteViews to a LiveCard but I would like to show a CardScrollView instead of coding everything in xml.

    CardScrollView csvCardsView; //has adapter, items,...

    RemoteViews aRV = new RemoteViews(this.getPackageName(), R.layout.card_text);
    if (mLiveCard == null) {
        mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID);
        mLiveCard.setViews(aRV);
        //... Action code
        mLiveCard.publish(LiveCard.PublishMode.REVEAL);
    }

Now I can't find out how to add my csvCardsView to my mLiveCard since LiveCard.setViews() only accepts RemoteViews and RemoteViews.addViews() also only accepts RemoteViews.

Wanna Coffee
  • 2,742
  • 7
  • 40
  • 66
Ferdau
  • 1,524
  • 1
  • 12
  • 21

1 Answers1

4

You cannot add a CardScrollView directly to a LiveCard. When viewing a LiveCard, the Glass timeline is handling the scrolling gestures from the touchpad and allowing a CardScrollView there would collide with that.

Instead, if what you're looking for is to display a CardScrollView when the user taps on a LiveCard, you can do that by creating an activity that has the CardScrollView and then set that activity as the LiveCard's action.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34