2016-05-12 68 views
0

我在Smarteyeglass应用程序中使用布局渲染(而不是位图渲染)。我如何获得对当前视图的引用?如何在Sony Smarteyeglass中查看参考?

我想根据代码中计算的值在我的布局中旋转一个ImageView。所以,我需要做的是这样的:

ViewGroup view = <GET THE VIEW HERE> 
    RelativeLayout relativeLayout = (RelativeLayout) RelativeLayout.inflate(context, 
        currentLayout, view); 
    relativeLayout.findViewById(R.id.my_view_object).setRotation(20); 

但问题是,我不能找到一个办法去根视图的引用。

我使用下面的代码,以显示我的布局:

Intent intent = new Intent(Control.Intents.CONTROL_PROCESS_LAYOUT_INTENT); 
    intent.putExtra(Control.Intents.EXTRA_DATA_XML_LAYOUT, R.layout.my_layout_id); 
    sendToHostApp(intent); 

没有返回到视图的参考。

回答

0

不幸的是,您不能动态访问查看布局中的元素。因为一旦使用showLayout方法或sendToHostApp方法,布局就会静态发送到SmartEyeglass。

如果您想对视图元素进行任何详细的更改,则需要再次发送完整布局。

但是,如果您尝试对视图元素中的文本或图像内容进行更改,则可以使用sendText和sendImage方法。