Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 获取信息窗口屏幕位置_Android_Infowindow - Fatal编程技术网

Android 获取信息窗口屏幕位置

Android 获取信息窗口屏幕位置,android,infowindow,Android,Infowindow,目前我有一个自定义信息窗口。当我点击它时,它将打开一个新的活动。我想为事务设置动画,为此我需要信息窗口在屏幕上的位置。由于infowindow是使用画布在屏幕上绘制的,因此我无法使用infowindow视图来获取其位置。是否有任何工作区可以存档此文件 谢谢 public View getInfoWindow(Marker marker) { if (mCurrentMarker != null && !mCurrentMarker.isInfoWindowShown()

目前我有一个自定义信息窗口。当我点击它时,它将打开一个新的活动。我想为事务设置动画,为此我需要信息窗口在屏幕上的位置。由于infowindow是使用画布在屏幕上绘制的,因此我无法使用infowindow视图来获取其位置。是否有任何工作区可以存档此文件

谢谢

public View getInfoWindow(Marker marker) {
    if (mCurrentMarker != null && !mCurrentMarker.isInfoWindowShown() && mCurrentMarkerView != null && marker.equals(mCurrentMarker))
        return mCurrentMarkerView;
    mCurrentMarker = marker;
    mCurrentMarkerView = getActivity().getLayoutInflater().inflate(R.layout.listing_infowindow, null);
    if (marker.getTitle() == null)
        return null;
    String[] data = marker.getTitle().split("@@@");
    ((TextView) mCurrentMarkerView.findViewById(R.id.infoText)).setText(data[0]);
    mCurrentMarkerView.findViewById(R.id.infoText).setTag(data[1]);
    ((TextView) mCurrentMarkerView.findViewById(R.id.infoDescription)).setText(marker.getSnippet());
    final ImageView img = (ImageView) mCurrentMarkerView.findViewById(R.id.infoIcon);
    String image;
    if (data.length < 3)
        image = "";
    else
        image = data[2];
    ImageLoader.getInstance().displayImage(image, img, new DisplayImageOptions.Builder()
             .showImageOnLoading(R.drawable.nopic)
             .showImageOnFail(R.drawable.nopic)
             .cacheInMemory(false)
             .cacheOnDisk(false)
             .considerExifParams(true)
             .build(), new SimpleImageLoadingListener() {
        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            super.onLoadingComplete(imageUri, view, loadedImage);

            if (mCurrentMarker != null && mCurrentMarker.isInfoWindowShown()) {
                mCurrentMarker.hideInfoWindow();
                mCurrentMarker.showInfoWindow();
            }

        }
    });

    return mCurrentMarkerView;

}
公共视图getInfoWindow(标记){
如果(mCurrentMarker!=null&&!mCurrentMarker.IsInfo窗口显示()&&mCurrentMarkerView!=null&&marker.equals(mCurrentMarker))
返回mCurrentMarkerView;
mCurrentMarker=标记;
mCurrentMarkerView=getActivity().getLayoutFlater().inflate(R.layout.listing_infowindow,null);
if(marker.getTitle()==null)
返回null;
String[]data=marker.getTitle().split(@@@@);
((TextView)mCurrentMarkerView.findviewbyd(R.id.infoText)).setText(数据[0]);
mCurrentMarkerView.findViewById(R.id.infoText).setTag(数据[1]);
((TextView)mCurrentMarkerView.findViewById(R.id.infoDescription)).setText(marker.getSnippet());
最终图像视图img=(图像视图)mCurrentMarkerView.findViewById(R.id.infoIcon);
字符串图像;
如果(数据长度<3)
image=“”;
其他的
图像=数据[2];
ImageLoader.getInstance().displayImage(图像、img、新的DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.nopic)
.showImageOnFail(R.drawable.nopic)
.cacheInMemory(false)
.cacheOnDisk(错误)
.considerExifParams(真)
.build(),新的SimpleImageLoadingListener(){
@凌驾
public void onLoadingComplete(字符串imageUri、视图视图、位图加载图像){
super.onLoadingComplete(imageUri、视图、LoadeImage);
if(mCurrentMarker!=null&&mCurrentMarker.IsInfo窗口显示(){
mCurrentMarker.hideInfo窗口();
mCurrentMarker.showInfoWindow();
}
}
});
返回mCurrentMarkerView;
}

你好,佩德罗,你能给我们看一些代码,让我们帮忙吗?我看不出有什么帮助。你需要什么代码?getInfoWindow是一段相当大的代码。除此之外,代码没有什么特别之处。我正在使用Google Maps群集,并在事件onClusterItemInfo WindowClick.show上显示新活动。告诉我们如何创建getInfoWindow.Edited。仍然不知道这段代码会有什么帮助,因为在返回方法之后,map将调用canvas.draw并在map上绘制视图。它将是一个图像而不是一个视图。你可以像marker一样获得marker的位置。getPosition()还可以看看Yeap它的工作原理。这是标记位置,我想要信息窗口,但这已经足够近了。再多学一点数学,我就能让它工作了。谢谢
Projection projection = map.getProjection();

LatLng markerLocation = marker.getPosition();

Point screenPosition = projection.toScreenLocation(markerLocation);