我正在尝试将照片球图像加载到活动中并像在图库中一样查看它。我似乎在网络上的任何地方都找不到此功能的任何示例或示例。
关于如何实现这一点的想法、示例、代码集或建议?
Photo Sphere API的公告帖子详细说明了如何从 URI 加载 PhotoSphere:
// This listener will be called with information about the given panorama.
OnPanoramaInfoLoadedListener infoLoadedListener =
new OnPanoramaInfoLoadedListener() {
@Override
public void onPanoramaInfoLoaded(ConnectionResult result,
Intent viewerIntent) {
if (result.isSuccess()) {
// If the intent is not null, the image can be shown as a
// panorama.
if (viewerIntent != null) {
// Use the given intent to start the panorama viewer.
startActivity(viewerIntent);
}
}
// If viewerIntent is null, the image is not a viewable panorama.
}
};
// Create client instance and connect to it.
PanoramaClient client = ...
...
// Once connected to the client, initiate the asynchronous check on whether
// the image is a viewable panorama.
client.loadPanoramaInfo(infoLoadedListener, panoramaUri);
请注意,这会在他们的查看器中打开 Photo Sphere - 没有内置的 Photo Sphere 查看器嵌入到您的Activity
.