带有Picasso图像的Android Studio Google Maps信息窗口仅显示第二次

时间:2018-06-22 22:20:21

标签: android google-maps android-studio google-maps-markers infowindow

我已使用毕加索成功将图像加载到信息窗口中,但遇到一个小问题。该图像仅在第二次关闭并重新打开信息窗口之后显示。

这是毕加索的称呼方式:

public class MarkerWindow_Adapter implements GoogleMap.InfoWindowAdapter {
    private static final String TAG = "MarkerWindow_Adapter";
    private LayoutInflater inflater;

    private TextView title;
    private ImageView img;

    public MarkerWindow_Adapter(LayoutInflater inflater) {
        this.inflater = inflater;
    }
    //coge los componentes de la consulta en el mapa_fragment
    @Override
    public View getInfoContents(final Marker m) {
        //Carga layout personalizado.
        View v = inflater.inflate(R.layout.activity_marker_window, null);


        title = v.findViewById(R.id.title);
        img = v.findViewById(R.id.img);

        title.setText(m.getTitle());
        //picasso agafa url i ho converteix amb imatge
        Picasso.get()
                .load(m.getSnippet())
                .resize(100, 100)
                .centerCrop()
                .into(img);


        return v;
    }

    @Override
    public View getInfoWindow(Marker m) {
        return null;
    }
}

感谢您的帮助!

0 个答案:

没有答案