0

我正在尝试在谷歌玻璃器皿的时间轴中设置背景图像。

我该怎么做?如何在视图页面中获取图像?

我尝试将图片网址设置为附件

TimelineItem timelineItem = new TimelineItem(); 
timelineItem.setText("Hello world"); 
InputStreamContent mediaContent = new InputStreamContent(contentType, attachment); 
service.timeline().insert(timelineItem, mediaContent).execute();

然后service.timeline().insert(timelineItem, mediaContent).execute();给出空指针异常。

4

1 回答 1

1

您看过Google Mirror API Playground吗?

其中一个模板显示了一张带有全出血背景图像的时间线卡片,卡片使用了这个 html:

<article class="photo">
  <img src="%background-image-url%" width="100%" height="100%">
  <div class="photo-overlay"></div>
  <section>
    <p class="text-auto-size">%CardText&</p>
  </section>
</article>

或者,您也可以添加您想要的图像作为附件,并且只提供text时间线项目中的部分。这将使用附加图像作为全出血背景图像并显示text在顶部,如下所述:https ://developers.google.com/glass/timeline#inserting_a_timeline_item_with_media

于 2013-11-12T14:11:50.430 回答