android - 如何在 VrPanoramaView 中动态移动图像

标签 android android-layout android-view panoramas

我在 VrPanoramaView 中使用了下图

enter image description here

当我在 View 中加载它时,它看起来像这样。

enter image description here

但我希望它在打开图像之前将图像动态移动到左侧,就像这样。

enter image description here

我可以用手指移动图像,但我希望它在加载时设置角度。

这是我的代码。

VrPanoramaView.Options options = new VrPanoramaView.Options();
InputStream inputStream = null;
AssetManager assetManager = getAssets();

inputStream = assetManager.open("test_2"+ ".jpg");
options.inputType = VrPanoramaView.Options.TYPE_MONO;

mVrPanoramaView.loadImageFromBitmap(BitmapFactory.decodeStream(inputStream), options);

mVrPanoramaView.setStereoModeButtonEnabled(false);
mVrPanoramaView.setInfoButtonEnabled(false);
mVrPanoramaView.setPureTouchTracking(true);
mVrPanoramaView.setFullscreenButtonEnabled(true);

我尝试了 mVrPanoramaView.setPivotX(100);,但没有任何影响。我需要知道如何使用任何手势在全景 View 中翻译图像。

我正在使用 GoogleVrSDK

implementation 'com.google.vr:sdk-base:1.160.0'
implementation 'com.google.vr:sdk-panowidget:1.170.0'

最佳答案

我想,你应该切换到 Video360 :

有更多迹象表明该组件已不再开发。

  1. Set initial angle of VrPanoramaView

There are no plans to add more functionality to the VrView widgets. But you more complex controls for a 360 media player, consider using the Video360 sample as a starting point. See #510 for more info.

  1. VR View for Android

Warning: These components were removed in v1.190 of the GVR SDK for Android. The Video360 sample should be used as a basis for creating 360 photo and video viewers. If you still want to use these widgets, you will need to use SDK v1.180 or earlier.

关于android - 如何在 VrPanoramaView 中动态移动图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56253941/

相关文章:

android - 在android中扩展相机 View ?

android - React Native 持续集成(支持 iOS & Android)

android - 错误 : Program type already present: android. support.v4.app

java - Android应用程序的多语言支持

android - 由 SwipeRefreshLayout 触发时在 RecyclerView 中执行 LayoutAnimation 时出现问题

android - 如果它是在其父级之外绘制的,是否可以检测到 View 点击?

android - 创建已附加 View 的副本

java - Proguard 不工作,eclipse(android) 不混淆

android-如何制作一步一步的向导

java - 将图像从一个 ImageButton 传输到另一个