Skobbler标注尾部imageview显示错误Android SDK 2.5.1

Kei*_*ith 6 java android skmaps

我有一些代码,它添加了一个自定义注释标注视图,只要在我的Skobbler mapview中选择了注释,就会显示该视图.

@Override
public void onAnnotationSelected(final SKAnnotation annotation) {
  ...
  mapPopup = mapHolder.getCalloutView();
  // set the callout view’s background color
  mapPopup.setViewColor(Color.WHITE);
  View view = getLayoutInflater().inflate(R.layout.map_callout, null);
  ...
  mapPopup.setCustomView(view);
  // setting 2nd parameter to 'true' will cause tail to be displayed
  mapPopup.showAtLocation(annotation.getLocation(), true);
  ...
}
Run Code Online (Sandbox Code Playgroud)

我还在showAtLocation()通话中请求使用"tail"imageview显示标注视图.但是,当我在应用程序中测试时,我看到尾部出现在map_surface_holderRelativeLayout容器的顶部,而不是显示callout弹出视图的FrameLayout容器的底部.

图像显示错误定位的尾部图像视图

当我平移地图时,我可以看到尾部视图相对于标注视图的移动向左和向右移动,但它仍然与map_surface_holder容器的顶部对齐,从不向上或向下移动.

我是否需要在某处添加一些代码以使尾部图像视图知道它应该放置在RelativeLayout容器的y轴方向的哪个位置?

我确实尝试添加一个调用来mapPopup.setVerticalOffset(offset)查看是否有任何效果,但尾部图像仍然锁定在屏幕顶部.

我在自定义标注视图和Skobbler提供的默认视图之间可以看到的另一个区别是标准视图是RelativeLayout容器,而我的实现是FrameLayout.但是,我不确定它是否重要,因为这里的Tail ImageView被添加到我的标注视图的父级,而不是作为孩子.

提前感谢您对此事的任何帮助,如果有任何其他细节会有所帮助,请告诉我.

谢谢!

And*_*ndo 0

我们尝试在 2.5.1 和 3.X 上重现该问题,但未能成功。

\n\n

这是我们使用的代码:

\n\n
//MapActivity\n    @Override\n    onCreate(Bundle savedInstanceState)\n    {\n    \xe2\x80\xa6\n    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n    mapPopup = mapViewGroup.getCalloutView();\n    View view = inflater.inflate(R.layout.layout_popup, null);\n    popupTitleView = (TextView) view.findViewById(R.id.top_text);\n    popupDescriptionView = (TextView) view.findViewById(R.id.bottom_text);\n    mapPopup.setCustomView(view);\n    \xe2\x80\xa6\n    }\n\n@Override\npublic void onAnnotationSelected(final SKAnnotation annotation) {\n    if (navigationUI.getVisibility() == View.VISIBLE) {\n        return;\n    }\n    // show the popup at the proper position when selecting an\n    // annotation\n    int annotationHeight = 0;\n    float annotationOffset = annotation.getOffset().getY();\n    switch (annotation.getUniqueID()) {\n        case 10:\n            annotationHeight =(int) (64 * getResources().getDisplayMetrics().density);\n            popupTitleView.setText("Annotation using  texture ID ");\n            popupDescriptionView.setText(null);\n            break;\n        case 11:\n            annotationHeight = customView.getHeight();\n            popupTitleView.setText("Annotation using custom view");\n            popupDescriptionView.setText(null);\n            break;\n    }\n    mapPopup.setVerticalOffset(-annotationOffset + annotationHeight / 2);\n    mapPopup.showAtLocation(annotation.getLocation(), true);\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

//layout_popup.xml\n\n

\n\n
<ImageView\n    android:id="@+id/left_image"\n    android:layout_width="wrap_content"\n    android:layout_height="wrap_content"\n    android:layout_alignParentLeft="true"\n    android:layout_centerVertical="true"\n    android:clickable="true"\n    android:padding="5dp"\n    android:src="@drawable/icon_map_popup_navigate" />\n\n<LinearLayout\n    android:id="@+id/mid_layout"\n    android:layout_width="wrap_content"\n    android:layout_height="wrap_content"\n    android:layout_centerVertical="true"\n    android:layout_toRightOf="@id/left_image"\n    android:orientation="vertical"\n    android:paddingBottom="5dp"\n    android:paddingRight="5dp"\n    android:paddingTop="5dp"\n    android:weightSum="1" >\n\n    <TextView\n        android:id="@+id/top_text"\n        android:layout_width="wrap_content"\n        android:layout_height="match_parent"\n        android:gravity="center"\n        android:text="Title text"\n        android:textColor="@color/black"\n        android:textSize="18dp"\n        android:textStyle="bold" />\n\n    <TextView\n        android:id="@+id/bottom_text"\n        android:layout_width="wrap_content"\n        android:layout_height="match_parent"\n        android:gravity="center"\n        android:linksClickable="true"\n        android:text="Subtitle text"\n        android:textColor="@color/black"\n        android:textSize="14dp" />\n</LinearLayout>\n
Run Code Online (Sandbox Code Playgroud)\n\n

\n