Panorama API - 在全景视图顶部膨胀布局

时间:2016-02-09 15:02:27

标签: android google-play-services google-street-view panorama-control

我使用google play services全景显示全景图像。 一切正常,但我想在该视图的顶部添加一个布局,以便将图像用作活动背景。

这是我展示全景视图的代码:

@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   mClient = new GoogleApiClient.Builder(this, this, this)
       .addApi(Panorama.API)
       .build();
 }

 @Override
    public void onConnected(Bundle bundle) {
        Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.pano1);
        Panorama.PanoramaApi.loadPanoramaInfo(mClient, uri).setResultCallback(
                new ResultCallback<PanoramaApi.PanoramaResult>() {
                    @Override
                    public void onResult(PanoramaApi.PanoramaResult result) {
                        if (result.getStatus().isSuccess()) {
                            Intent viewerIntent = result.getViewerIntent();
                            Log.i(TAG, "found viewerIntent: " + viewerIntent);
                            if (viewerIntent != null) {
                                startActivity(viewerIntent);
                            }
                        } else {
                            Log.e(TAG, "error: " + result);
                        }
                    }
                });
    }

工作流程是我使用ViewerIntent开始新活动而我没有布局控制,所以它只显示全景视图。

我正在搜索以下其中一项:

  • 控制openning ViewerIntent活动
  • 通过包
  • 将布局传递到下一个活动
  • 覆盖全景视图活动,并填充我自己的布局

Google街景全景活动示例:

enter image description here

1 个答案:

答案 0 :(得分:0)

Google API中的Panorama API似乎没有您正在寻找的那么多功能。基于PanoramaResult(getViewerIntent)的返回描述,

  

如果图像是全景图像,则该图像不为空,并在启动时启动查看器。如果图像不是全景图,则该图像将为空。

您可能需要搜索第三方库或根据您需要创建自己的实施。