我想从我的 android 应用程序中显示全景图,这个全景图是在线的,我有它的 url,我将它加载到 webview 上,但它不能正常工作。它只是出现了它的一部分,它不会转动或倒置。我不知道从哪里开始,你能指出我正确的方向吗?先感谢您
问问题
7566 次
3 回答
5
经过大量研究后,我发现这个库仍然很新,但肯定可以帮助您开始做一些事情。我发布它只是为了节省其他搜索者的时间!欢呼 PanoramaGl
于 2014-01-09T12:59:10.527 回答
2
我在 Kotlin 中也遇到过类似的情况,但我需要从 URL 中获取图像。我用毕加索解决了这个问题。我将其留在这里以供将来参考:
val options = VrPanoramaView.Options()
val url = "https://urltoyourimage.com/image.jpg"
Picasso.get().load(url)
.into(object : Target {
override fun onBitmapLoaded(bitmap: Bitmap?, from: Picasso.LoadedFrom?) {
options.inputType = VrPanoramaView.Options.TYPE_MONO
vrPanoramaView.loadImageFromBitmap(bitmap, options)
}
override fun onBitmapFailed(e: Exception?, errorDrawable: Drawable?) {
print(e?.localizedMessage)
}
override fun onPrepareLoad(placeHolderDrawable: Drawable?) {
print(placeHolderDrawable)
}
})
于 2019-10-07T00:17:31.133 回答
0
在 gradle 中添加依赖项(应用程序级别)
compile 'com.google.vr:sdk-panowidget:1.80.0'
添加
VrPanoramaView
您的xml并通过findViewById()
android中的方法获取参考下面是从资产加载图像的代码。
VrPanoramaView
将输入作为位图,因此我们需要首先将其转换为正确的格式。在这里,loadPhotoSphere
调用的函数onCreate()
private void loadPhotoSphere() {
VrPanoramaView.Options options = new VrPanoramaView.Options();
InputStream inputStream = null;
try {
inputStream = assetManager.open("image.jpg");
options.inputType = VrPanoramaView.Options.TYPE_MONO;
mVRPanoramaView.loadImageFromBitmap(BitmapFactory.decodeStream(inputStream), options);
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
在此处阅读适用于 Android 的 Google VR SDK
于 2017-11-12T12:29:28.593 回答