带有个人资料图片的标记

时间:2015-04-10 01:41:12

标签: image view marker picasso

我想使用毕加索图书馆显示带有个人资料图片图像的标记。

我无法确定如何。 userProfilePicture是用户个人资料图片的网址,我存储在userProfilePictureReceived上。

public class GoogleMaps extends Activity implements OnMapReadyCallback {
    protected GoogleMap map;
    protected String userNameReceived;
    protected String userProfilePictureReceived;
    protected Bitmap bmp;
    protected BitmapDescriptor icon;
    protected Canvas canvas1;
    protected ImageView icon2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_maps);
        MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);

        userNameReceived = MainActivity.userName;//using global variable userName from MainActivity class
        userProfilePictureReceived = MainActivity.userProfilePicture;
       // icon2 = (ImageView) findViewById(R.id.imageView2);
        icon2.draw(canvas1);



        Bitmap.Config conf = Bitmap.Config.ARGB_8888;
        bmp = Bitmap.createBitmap(80, 80, conf);
        canvas1 = new Canvas(bmp);

    }


    @Override
    protected void onRestart() {
        super.onRestart();
    }

    @Override
    protected void onStart() {
        Picasso.with(GoogleMaps.this)
                .load(userProfilePictureReceived)
                .resize(100, 100)
                .config(Bitmap.Config.ARGB_4444)
                        //  .error(R.drawable.abc_btn_radio_to_on_mtrl_015)  // en caso de no tener imagen pone una predeterminada
                .transform(new RoundedTransformation(50, 4))
                .into(icon2);

        icon2.draw(canvas1);
       // BitmapDrawable drawable = (BitmapDrawable) icon2.getDrawable();
        //userPictureAsGeoPoint = drawable.getBitmap();
        //icon = BitmapDescriptorFactory.fromBitmap(userPictureAsGeoPoint);
        super.onStart();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
protected void onStop() {
    super.onStop();
}

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onMapReady(GoogleMap map) {
        map.addMarker(new MarkerOptions()
                .position(new LatLng(10, 10))
                .title(userNameReceived))
                .setIcon(BitmapDescriptorFactory.fromBitmap(bmp));


        //marker.showInfoWindow
        //marker.showInfoWindow
        //setVisibility
    }
}

0 个答案:

没有答案