2014-01-21 40 views

回答

2

這裏有兩種方法可以活卡上呈現的內容,如在https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/timeline/LiveCard

埃拉德的方式記錄是第一位的,你想要什麼 - 「充氣使用遠程視圖的佈局」。這樣創建的活卡被稱爲低頻活卡。

另一種方式是直接在活動卡片表面上繪圖,例如使用Canvas API。這樣創建的現場卡被稱爲高頻活卡。

https://developers.google.com/glass/develop/gdk/ui/live-cards有一些進一步的文檔解釋和示例代碼,顯示如何創建兩種類型的活卡。

0
LiveCard liveCard; // initialized elsewhere 
    RemoteViews views = new RemoteViews(context.getPackageName(), 
      R.layout.my_layout); 
    liveCard.setViews(views); 
0

可以使用CardBuilder建築玻璃式卡片

mLiveCard = new LiveCard(this, LIVE_CARD_TAG); 

RemoteViews remoteView = new CardBuilder(getApplicationContext(), CardBuilder.Layout.TEXT) 
       .setText("You can also add images to the background of a TEXT card.") 
       .setFootnote("This is the footnote") 
       .setTimestamp("just now") 
       .addImage(R.drawable.ic_lap) 
       .getRemoteViews(); 
     mLiveCard.setViews(remoteView); 

更多的例子檢查此GDK鏈接card_design

相關問題