Использование ViewRenderable Я рендеринг файла макета.Я дал фиксированную ширину и высоту для файла макета
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="500dp"
android:layout_height="50dp"
android:background="@android:color/transparent">
// Add design
</android.support.constraint.ConstraintLayout>
Теперь я создаю макет как ViewRenderable
// Build a renderable from a 2D View.
CompletableFuture<ViewRenderable> meterOne =
ViewRenderable.builder().setView(this, R.layout.meter).build();
CompletableFuture.allOf(circle,
meterOne, meterTwo)
.handle(
(notUsed, throwable) -> {
// When you build a Renderable, Sceneform loads its resources in the background while
// returning a CompletableFuture. Call handle(), thenAccept(), or check isDone()
// before calling get().
if (throwable != null) {
DemoUtils.displayError(this, "Unable to load renderable", throwable);
return null;
}
try {
Meters.add(meterOne.get());
} catch (InterruptedException | ExecutionException ex) {
DemoUtils.displayError(this, "Unable to load renderable", ex);
}
После этого мне нужно визуализировать этот ViewRenderable
Объект в узел
Node sunVisual = new Node();
sunVisual.setParent(sun);
sunVisual.setRenderable(Meters.get(0)); // View
sunVisual.setLocalScale(new Vector3(0.5f, 0.5f, 0.5f));
Теперь мне нужно добавить еще один узел справа от узла sunVisual
Node node = new Node();
node.setParent(sunVisual );
node.setRenderable(Meters.get(1));
node.setLocalPosition(new Vector3(2.0f, 0.0f, 0.0f));
Этот код хорошо работает на устройствах Google Pixel 2, но в устройстве Nokia X6 у меня мало места
Скриншот Google pixel 2 ![Google pixel 2 image](https://i.stack.imgur.com/lLR0L.jpg)
Скриншот Nokia x6 ![Nokia x6 screenshot](https://i.stack.imgur.com/m7qs6.jpg)
Как получить ширину и высоту визуализированного вида в метрах?
Как установить локальную позицию справа от родительского узла на основе размера визуализированного представления родительского узла
Помогите мне решить эту проблему, заранее спасибо