Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中为viewrenderable视图显示不同的文本_Android_Augmented Reality_Sceneform - Fatal编程技术网

在android中为viewrenderable视图显示不同的文本

在android中为viewrenderable视图显示不同的文本,android,augmented-reality,sceneform,Android,Augmented Reality,Sceneform,显示视图可渲染视图的不同文本。(例如)fl测量值为10,12,15,但所有视图均显示15,15,15。我需要显示文本视图是10,12,15。最后一个值将替换所有行中的值。请帮我解决这个问题 //this is my viewrenderable ViewRenderable.builder() .setView(this, R.layout.measure_view) .build() .thenAc

显示视图可渲染视图的不同文本。(例如)fl测量值为10,12,15,但所有视图均显示15,15,15。我需要显示文本视图是10,12,15。最后一个值将替换所有行中的值。请帮我解决这个问题

//this is my viewrenderable
ViewRenderable.builder()
                .setView(this, R.layout.measure_view)
                .build()
                .thenAccept(renderable -> measureViewRenderable = renderable).exceptionally(
                throwable -> {
                    Toast toast =
                            Toast.makeText(this, "Unable to load andy renderable", Toast.LENGTH_LONG);
                    toast.setGravity(Gravity.CENTER, 0, 0);
                    toast.show();
                    return null;
                });


我在研究同一主题,现在似乎我们需要通过重新使用ViewRenderable.builder()来创建不同的ViewRenderable,以便在每个视图中都有不同的数据。

我在研究同一主题,现在似乎我们需要通过重新使用ViewRenderable.builder()来创建不同的ViewRenderable以便在每个数据库中有不同的数据

//I will show the text message above the line using viewrenderable view


private void addLineBetweenHits(HitResult hitResult, Plane plane, MotionEvent motionEvent) {

        Anchor anchor = hitResult.createAnchor();
        AnchorNode anchorNode = new AnchorNode(anchor);


        if (myanchornode != null) {
            anchorNode.setParent(arFragment.getArSceneView().getScene());
            point1 = myanchornode.getWorldPosition();
            point2 = anchorNode.getWorldPosition();

    /*
        First, find the vector extending between the two points and define a look rotation
        in terms of this Vector.
    */
            final Vector3 difference = Vector3.subtract(point1, point2);
            final Vector3 directionFromTopToBottom = difference.normalized();
            final Quaternion rotationFromAToB =
                    Quaternion.lookRotation(directionFromTopToBottom, Vector3.up());

            node = new Node();


            MaterialFactory.makeOpaqueWithColor(getApplicationContext(), new Color(0, 255, 244))
                    .thenAccept(
                            material -> {
                            /* Then, create a rectangular prism, using ShapeFactory.makeCube() and use the difference vector
                                   to extend to the necessary length.  */
                                ModelRenderable model = ShapeFactory.makeCube(
                                        new Vector3(.01f, .01f, difference.length()),
                                        Vector3.zero(), material);
                            /* Last, set the world rotation of the node to the rotation calculated earlier and set the world position to
                                   the midpoint between the given points . */
                                node.setParent(anchorNode);
                                node.setRenderable(model);
                                node.setWorldPosition(Vector3.add(point1, point2).scaled(.5f));
                                node.setWorldRotation(rotationFromAToB);
                            }
                    );
            myanchornode = anchorNode;

            TransformableNode andy = new TransformableNode(arFragment.getTransformationSystem());
            andy.setParent(anchorNode);
            andy.setRenderable(measureViewRenderable);



TextView view=(TextView) measureViewRenderable.getView().findViewById(R.id.txtMeasure);

  view.setText("" + fl_measurement.get(fl_measurement.size() - 1));

            
            andy.select();
            andy.getScaleController().setEnabled(false);


        }
    }