在ARCore中使用ImageView显示图像

时间:2019-01-28 14:40:51

标签: android imageview arcore

我正在尝试在ARCore中显示2D PNG图像,但是什么也没有显示。 当我尝试使用ModelRenderable进行渲染时,3D对象的渲染可以完美地工作。因此,尝试使用ViewRenderable渲染图像时,我做错了事。

这是与渲染有关的代码:在下面的代码中,我得到错误/警告,从未使用'imageView'。

ViewRenderable.builder()
                      .setView(context, R.layout.imgboard)
                      .build()
                      .thenAccept(renderable -> {
                      ImageView imageView = (ImageView) renderable.getView();
                      });

这是XML文件:

<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/imageCard"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/qbf"
    android:adjustViewBounds="true"
    android:scaleType="centerInside"/>

1 个答案:

答案 0 :(得分:1)

example code使用:

library(rscopus)
x = abstract_retrieval("10.1109/ISCSLP.2014.6936630", identifier= "doi")
#> HTTP specified is:https://api.elsevier.com/content/abstract/doi/10.1109/ISCSLP.2014.6936630
x$content
#> $`service-error`
#> $`service-error`$status
#> $`service-error`$status$statusCode
#> [1] "RESOURCE_NOT_FOUND"
#> 
#> $`service-error`$status$statusText
#> [1] "The resource specified cannot be found."

process_author_name(last_name = "Lin", first_name = "Xuee")
#> HTTP specified is (without API key): https://api.elsevier.com/content/search/author?query=AUTHFIRST%28Xuee%29%2BAND%2BAUTHLAST%28Lin%29&count=200&start=0
#> Error in process_author_name(last_name = "Lin", first_name = "Xuee"): No author name found

与您的稍有不同,因为您添加了lambda。

您可能想删除此lambda,最后显示为:

.thenAccept(renderable -> testViewRenderable = renderable);

您还需要定义.thenAccept(renderable -> myRenderable = renderable); (不是myRenderable):

the docs中有一个最小的例子。