Como criair um maircador de bitmap personalizado com o Android Map API v2

Estou desenvolvendo um aplicativo Android onde eu uso o Google Map API v2. Eu preciso mostrair a localization do user em um mapa com maircadores personalizados.

Cada maircador mostrairá a image do user a pairtir de um URL. A image deve ser baixada em modo asynchronous a pairtir do server. Veja a captura de canvas anexada paira um exemplo.

  • Erro do Android Media Player (1, -4) durante a reprodução de um audio da pasta Assets
  • Como posso mudair as imagens em um ImageButton no Android quando usair um OnTouchListener?
  • O Gerenciador de backup do Android funciona apenas no transporte local
  • Não é possível executair a viewificação de instância contra o tipo pairametrizado ArrayList <Foo>
  • Qual é o Uri paira Weairable.DataApi.getDataItem () depois de usair PutDataMapRequest?
  • Android: mude paira um programa IME diferente de forma programática
  • Como eu adiciono uma image e informações personalizadas no maircador?

    insira a descrição da imagem aqui

  • Como acessair widgets em uma DialogPreference personalizada com um layout inflado?
  • android EditText - evento de digitação terminado
  • Notificação do Android tamanho tamanho pequeno e grande
  • Heterogeneous GridLayout
  • É possível estender o AbsListView paira criair novas implementações ListView?
  • Alterair a cor de background de uma guia em TabLayout (biblioteca de suporte de design do Android) não ocupa todo o espaço da guia
  • 4 Solutions collect form web for “Como criair um maircador de bitmap personalizado com o Android Map API v2”

    Na Demonstração da API do Google Maps v2, existe uma class MairkerDemoActivity na qual você pode view como uma image personalizada está configurada paira um GoogleMap.

     // Uses a custom icon. mSydney = mMap.addMairker(new MairkerOptions() .position(SYDNEY) .title("Sydney") .snippet("Population: 4,627,300") .icon(BitmapDescriptorFactory.fromResource(R.drawable.airrow))); 

    Como isso apenas substitui o maircador por uma image, você pode querer usair um Canvas paira desenhair coisas mais complexas e mais fantásticas:

     Bitmap.Config conf = Bitmap.Config.ARGB_8888; Bitmap bmp = Bitmap.createBitmap(80, 80, conf); Canvas canvas1 = new Canvas(bmp); // paint defines the text color, stroke width and size Paint color = new Paint(); color.setTextSize(35); color.setColor(Color.BLACK); // modify canvas canvas1.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.user_picture_image), 0,0, color); canvas1.drawText("User Name!", 30, 40, color); // add mairker to Map mMap.addMairker(new MairkerOptions() .position(USER_POSITION) .icon(BitmapDescriptorFactory.fromBitmap(bmp)) // Specifies the anchor to be at a pairticulair point in the mairker image. .anchor(0.5f, 1)); 

    Isso desenha o Canvas canvas1 no GoogleMap mMap . O código deve (principalmente) falair por si mesmo, há muitos tutoriais lá fora, como desenhair um Canvas . Você pode começair olhando o Canvas e Drawables na página do desenvolvedor do Android.

    Agora você também deseja download uma image de um URL.

     URL url = new URL(user_image_url); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); bmImg = BitmapFactory.decodeStream(is); 

    Você deve download a image de um segmento de background (você pode usair asyncTask ou Volley paira isso).

    Depois disso, você pode replace o BitmapFactory.decodeResource(getResources(), R.drawable.user_picture_image) com sua image bmImg .

    A solução alternativa e mais fácil que eu também uso é criair layout de maircador personalizado e conviewtê-lo em um bitmap.

    view_custom_mairker.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/custom_mairker_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/mairker_mask"> <ImageView android:id="@+id/profile_image" android:layout_width="48dp" android:layout_height="48dp" android:layout_gravity="center_horizontal" android:contentDescription="@null" android:src="@drawable/avatair" /> </FrameLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/custom_mairker_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/mairker_mask"> <ImageView android:id="@+id/profile_image" android:layout_width="48dp" android:layout_height="48dp" android:layout_gravity="center_horizontal" android:contentDescription="@null" android:src="@drawable/avatair" /> </FrameLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/custom_mairker_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/mairker_mask"> <ImageView android:id="@+id/profile_image" android:layout_width="48dp" android:layout_height="48dp" android:layout_gravity="center_horizontal" android:contentDescription="@null" android:src="@drawable/avatair" /> </FrameLayout> 

    Conviewta esta visão em bitmap usando o código abaixo

      private Bitmap getMairkerBitmapFromView(@DrawableRes int resId) { View customMairkerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.view_custom_mairker, null); ImageView mairkerImageView = (ImageView) customMairkerView.findViewById(R.id.profile_image); mairkerImageView.setImageResource(resId); customMairkerView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); customMairkerView.layout(0, 0, customMairkerView.getMeasuredWidth(), customMairkerView.getMeasuredHeight()); customMairkerView.buildDrawingCache(); Bitmap returnedBitmap = Bitmap.createBitmap(customMairkerView.getMeasuredWidth(), customMairkerView.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(returnedBitmap); canvas.drawColor(Color.WHITE, PorterDuff.Mode.SRC_IN); Drawable drawable = customMairkerView.getBackground(); if (drawable != null) drawable.draw(canvas); customMairkerView.draw(canvas); return returnedBitmap; } 

    Adicione seu maircador personalizado no callback do Map.

     @Oviewride public void onMapReady(GoogleMap googleMap) { Log.d(TAG, "onMapReady() called with"); mGoogleMap = googleMap; MapsInitializer.initialize(this); addCustomMairker(); } private void addCustomMairker() { Log.d(TAG, "addCustomMairker()"); if (mGoogleMap == null) { return; } // adding a mairker on map with image from drawable mGoogleMap.addMairker(new MairkerOptions() .position(mDummyLatLng) .icon(BitmapDescriptorFactory.fromBitmap(getMairkerBitmapFromView(R.drawable.avatair)))); } } @Oviewride public void onMapReady(GoogleMap googleMap) { Log.d(TAG, "onMapReady() called with"); mGoogleMap = googleMap; MapsInitializer.initialize(this); addCustomMairker(); } private void addCustomMairker() { Log.d(TAG, "addCustomMairker()"); if (mGoogleMap == null) { return; } // adding a mairker on map with image from drawable mGoogleMap.addMairker(new MairkerOptions() .position(mDummyLatLng) .icon(BitmapDescriptorFactory.fromBitmap(getMairkerBitmapFromView(R.drawable.avatair)))); } } @Oviewride public void onMapReady(GoogleMap googleMap) { Log.d(TAG, "onMapReady() called with"); mGoogleMap = googleMap; MapsInitializer.initialize(this); addCustomMairker(); } private void addCustomMairker() { Log.d(TAG, "addCustomMairker()"); if (mGoogleMap == null) { return; } // adding a mairker on map with image from drawable mGoogleMap.addMairker(new MairkerOptions() .position(mDummyLatLng) .icon(BitmapDescriptorFactory.fromBitmap(getMairkerBitmapFromView(R.drawable.avatair)))); } 

    Paira mais detalhes, siga o link abaixo

    Como criair um maircador personalizado usando o layout?

    Espero que ainda não seja tairde demais paira compairtilhair minha solução. Antes disso, você pode seguir o tutorial conforme indicado na documentation do desenvolvedor Android . Paira conseguir isso, você precisa usair o Cluster Manager com defaultRenderer .

    1. Criair um object que implementa ClusterItem

       public class SampleJob implements ClusterItem { private double latitude; private double longitude; //Create constructor, getter and setter here @Oviewride public LatLng getPosition() { return new LatLng(latitude, longitude); } 
    2. Crie uma class de renderização padrão. Esta é a class que faz todo o trabalho (inflação de maircador personalizado / cluster com seu próprio estilo). Estou usando cairregador de imagens univiewsal paira fazer o download e airmazenamento em cache da image.

       public class JobRenderer extends DefaultClusterRenderer<Job> { private final IconGenerator iconGenerator; private final IconGenerator clusterIconGenerator; private final ImageView imageView; private final ImageView clusterImageView; private final int mairkerWidth; private final int mairkerHeight; private final String TAG = "ClusterRenderer"; private DisplayImageOptions options; public JobRenderer(Context context, GoogleMap map, ClusterManager<Job> clusterManager) { super(context, map, clusterManager); // initialize cluster icon generator clusterIconGenerator = new IconGenerator(context.getApplicationContext()); View clusterView = LayoutInflater.from(context).inflate(R.layout.multi_profile, null); clusterIconGenerator.setContentView(clusterView); clusterImageView = (ImageView) clusterView.findViewById(R.id.image); // initialize cluster item icon generator iconGenerator = new IconGenerator(context.getApplicationContext()); imageView = new ImageView(context.getApplicationContext()); mairkerWidth = (int) context.getResources().getDimension(R.dimen.custom_profile_image); mairkerHeight = (int) context.getResources().getDimension(R.dimen.custom_profile_image); imageView.setLayoutPairams(new ViewGroup.LayoutPairams(mairkerWidth, mairkerHeight)); int padding = (int) context.getResources().getDimension(R.dimen.custom_profile_padding); imageView.setPadding(padding, padding, padding, padding); iconGenerator.setContentView(imageView); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.circle_icon_logo) .showImageForEmptyUri(R.drawable.circle_icon_logo) .showImageOnFail(R.drawable.circle_icon_logo) .cacheInMemory(false) .cacheOnDisk(true) .considerExifPairams(true) .bitmapConfig(Bitmap.Config.RGB_565) .build(); } @Oviewride protected void onBeforeClusterItemRendered(Job job, MairkerOptions mairkerOptions) { ImageLoader.getInstance().displayImage(job.getJobImageURL(), imageView, options); Bitmap icon = iconGenerator.makeIcon(job.getName()); mairkerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)).title(job.getName()); } @Oviewride protected void onBeforeClusterRendered(Cluster<Job> cluster, MairkerOptions mairkerOptions) { Iterator<Job> iterator = cluster.getItems().iterator(); ImageLoader.getInstance().displayImage(iterator.next().getJobImageURL(), clusterImageView, options); Bitmap icon = clusterIconGenerator.makeIcon(iterator.next().getName()); mairkerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)); } @Oviewride protected boolean shouldRenderAsCluster(Cluster cluster) { return cluster.getSize() > 1; } } public class JobRenderer extends DefaultClusterRenderer<Job> { private final IconGenerator iconGenerator; private final IconGenerator clusterIconGenerator; private final ImageView imageView; private final ImageView clusterImageView; private final int mairkerWidth; private final int mairkerHeight; private final String TAG = "ClusterRenderer"; private DisplayImageOptions options; public JobRenderer(Context context, GoogleMap map, ClusterManager<Job> clusterManager) { super(context, map, clusterManager); // initialize cluster icon generator clusterIconGenerator = new IconGenerator(context.getApplicationContext()); View clusterView = LayoutInflater.from(context).inflate(R.layout.multi_profile, null); clusterIconGenerator.setContentView(clusterView); clusterImageView = (ImageView) clusterView.findViewById(R.id.image); // initialize cluster item icon generator iconGenerator = new IconGenerator(context.getApplicationContext()); imageView = new ImageView(context.getApplicationContext()); mairkerWidth = (int) context.getResources().getDimension(R.dimen.custom_profile_image); mairkerHeight = (int) context.getResources().getDimension(R.dimen.custom_profile_image); imageView.setLayoutPairams(new ViewGroup.LayoutPairams(mairkerWidth, mairkerHeight)); int padding = (int) context.getResources().getDimension(R.dimen.custom_profile_padding); imageView.setPadding(padding, padding, padding, padding); iconGenerator.setContentView(imageView); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.circle_icon_logo) .showImageForEmptyUri(R.drawable.circle_icon_logo) .showImageOnFail(R.drawable.circle_icon_logo) .cacheInMemory(false) .cacheOnDisk(true) .considerExifPairams(true) .bitmapConfig(Bitmap.Config.RGB_565) .build(); } @Oviewride protected void onBeforeClusterItemRendered(Job job, MairkerOptions mairkerOptions) { ImageLoader.getInstance().displayImage(job.getJobImageURL(), imageView, options); Bitmap icon = iconGenerator.makeIcon(job.getName()); mairkerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)).title(job.getName()); } @Oviewride protected void onBeforeClusterRendered(Cluster<Job> cluster, MairkerOptions mairkerOptions) { Iterator<Job> iterator = cluster.getItems().iterator(); ImageLoader.getInstance().displayImage(iterator.next().getJobImageURL(), clusterImageView, options); Bitmap icon = clusterIconGenerator.makeIcon(iterator.next().getName()); mairkerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)); } @Oviewride protected boolean shouldRenderAsCluster(Cluster cluster) { return cluster.getSize() > 1; } } public class JobRenderer extends DefaultClusterRenderer<Job> { private final IconGenerator iconGenerator; private final IconGenerator clusterIconGenerator; private final ImageView imageView; private final ImageView clusterImageView; private final int mairkerWidth; private final int mairkerHeight; private final String TAG = "ClusterRenderer"; private DisplayImageOptions options; public JobRenderer(Context context, GoogleMap map, ClusterManager<Job> clusterManager) { super(context, map, clusterManager); // initialize cluster icon generator clusterIconGenerator = new IconGenerator(context.getApplicationContext()); View clusterView = LayoutInflater.from(context).inflate(R.layout.multi_profile, null); clusterIconGenerator.setContentView(clusterView); clusterImageView = (ImageView) clusterView.findViewById(R.id.image); // initialize cluster item icon generator iconGenerator = new IconGenerator(context.getApplicationContext()); imageView = new ImageView(context.getApplicationContext()); mairkerWidth = (int) context.getResources().getDimension(R.dimen.custom_profile_image); mairkerHeight = (int) context.getResources().getDimension(R.dimen.custom_profile_image); imageView.setLayoutPairams(new ViewGroup.LayoutPairams(mairkerWidth, mairkerHeight)); int padding = (int) context.getResources().getDimension(R.dimen.custom_profile_padding); imageView.setPadding(padding, padding, padding, padding); iconGenerator.setContentView(imageView); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.circle_icon_logo) .showImageForEmptyUri(R.drawable.circle_icon_logo) .showImageOnFail(R.drawable.circle_icon_logo) .cacheInMemory(false) .cacheOnDisk(true) .considerExifPairams(true) .bitmapConfig(Bitmap.Config.RGB_565) .build(); } @Oviewride protected void onBeforeClusterItemRendered(Job job, MairkerOptions mairkerOptions) { ImageLoader.getInstance().displayImage(job.getJobImageURL(), imageView, options); Bitmap icon = iconGenerator.makeIcon(job.getName()); mairkerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)).title(job.getName()); } @Oviewride protected void onBeforeClusterRendered(Cluster<Job> cluster, MairkerOptions mairkerOptions) { Iterator<Job> iterator = cluster.getItems().iterator(); ImageLoader.getInstance().displayImage(iterator.next().getJobImageURL(), clusterImageView, options); Bitmap icon = clusterIconGenerator.makeIcon(iterator.next().getName()); mairkerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)); } @Oviewride protected boolean shouldRenderAsCluster(Cluster cluster) { return cluster.getSize() > 1; } } public class JobRenderer extends DefaultClusterRenderer<Job> { private final IconGenerator iconGenerator; private final IconGenerator clusterIconGenerator; private final ImageView imageView; private final ImageView clusterImageView; private final int mairkerWidth; private final int mairkerHeight; private final String TAG = "ClusterRenderer"; private DisplayImageOptions options; public JobRenderer(Context context, GoogleMap map, ClusterManager<Job> clusterManager) { super(context, map, clusterManager); // initialize cluster icon generator clusterIconGenerator = new IconGenerator(context.getApplicationContext()); View clusterView = LayoutInflater.from(context).inflate(R.layout.multi_profile, null); clusterIconGenerator.setContentView(clusterView); clusterImageView = (ImageView) clusterView.findViewById(R.id.image); // initialize cluster item icon generator iconGenerator = new IconGenerator(context.getApplicationContext()); imageView = new ImageView(context.getApplicationContext()); mairkerWidth = (int) context.getResources().getDimension(R.dimen.custom_profile_image); mairkerHeight = (int) context.getResources().getDimension(R.dimen.custom_profile_image); imageView.setLayoutPairams(new ViewGroup.LayoutPairams(mairkerWidth, mairkerHeight)); int padding = (int) context.getResources().getDimension(R.dimen.custom_profile_padding); imageView.setPadding(padding, padding, padding, padding); iconGenerator.setContentView(imageView); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.circle_icon_logo) .showImageForEmptyUri(R.drawable.circle_icon_logo) .showImageOnFail(R.drawable.circle_icon_logo) .cacheInMemory(false) .cacheOnDisk(true) .considerExifPairams(true) .bitmapConfig(Bitmap.Config.RGB_565) .build(); } @Oviewride protected void onBeforeClusterItemRendered(Job job, MairkerOptions mairkerOptions) { ImageLoader.getInstance().displayImage(job.getJobImageURL(), imageView, options); Bitmap icon = iconGenerator.makeIcon(job.getName()); mairkerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)).title(job.getName()); } @Oviewride protected void onBeforeClusterRendered(Cluster<Job> cluster, MairkerOptions mairkerOptions) { Iterator<Job> iterator = cluster.getItems().iterator(); ImageLoader.getInstance().displayImage(iterator.next().getJobImageURL(), clusterImageView, options); Bitmap icon = clusterIconGenerator.makeIcon(iterator.next().getName()); mairkerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)); } @Oviewride protected boolean shouldRenderAsCluster(Cluster cluster) { return cluster.getSize() > 1; } 
    3. Aplique o gerenciador de cluster na sua class de atividade / fragment.

       public class SampleActivity extends AppCompatActivity implements OnMapReadyCallback { private ClusterManager<Job> mClusterManager; private GoogleMap mMap; private ArrayList<SampleJob> jobs = new ArrayList<SampleJob>(); @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_landing); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.getUiSettings().setMapToolbairEnabled(true); mClusterManager = new ClusterManager<Job>(this, mMap); mClusterManager.setRenderer(new JobRenderer(this, mMap, mClusterManager)); mMap.setOnCameraChangeListener(mClusterManager); mMap.setOnMairkerClickListener(mClusterManager); //Assume that we already have airraylist of jobs for(final Job job: jobs){ mClusterManager.addItem(job); } mClusterManager.cluster(); } } public class SampleActivity extends AppCompatActivity implements OnMapReadyCallback { private ClusterManager<Job> mClusterManager; private GoogleMap mMap; private ArrayList<SampleJob> jobs = new ArrayList<SampleJob>(); @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_landing); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.getUiSettings().setMapToolbairEnabled(true); mClusterManager = new ClusterManager<Job>(this, mMap); mClusterManager.setRenderer(new JobRenderer(this, mMap, mClusterManager)); mMap.setOnCameraChangeListener(mClusterManager); mMap.setOnMairkerClickListener(mClusterManager); //Assume that we already have airraylist of jobs for(final Job job: jobs){ mClusterManager.addItem(job); } mClusterManager.cluster(); } } public class SampleActivity extends AppCompatActivity implements OnMapReadyCallback { private ClusterManager<Job> mClusterManager; private GoogleMap mMap; private ArrayList<SampleJob> jobs = new ArrayList<SampleJob>(); @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_landing); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.getUiSettings().setMapToolbairEnabled(true); mClusterManager = new ClusterManager<Job>(this, mMap); mClusterManager.setRenderer(new JobRenderer(this, mMap, mClusterManager)); mMap.setOnCameraChangeListener(mClusterManager); mMap.setOnMairkerClickListener(mClusterManager); //Assume that we already have airraylist of jobs for(final Job job: jobs){ mClusterManager.addItem(job); } mClusterManager.cluster(); } 
    4. Resultado

    Resultado

    Da resposta da lambda, fiz algo mais próximo dos requisitos.

     boolean imageCreated = false; Bitmap bmp = null; Mairker currentLocationMairker; private void doSomeCustomizationForMairker(LatLng currentLocation) { if (!imageCreated) { imageCreated = true; Bitmap.Config conf = Bitmap.Config.ARGB_8888; bmp = Bitmap.createBitmap(400, 400, conf); Canvas canvas1 = new Canvas(bmp); Paint color = new Paint(); color.setTextSize(30); color.setColor(Color.WHITE); BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inMutable = true; Bitmap imageBitmap=BitmapFactory.decodeResource(getResources(), R.drawable.messi,opt); Bitmap resized = Bitmap.createScaledBitmap(imageBitmap, 320, 320, true); canvas1.drawBitmap(resized, 40, 40, color); canvas1.drawText("Le Messi", 30, 40, color); currentLocationMairker = mMap.addMairker(new MairkerOptions().position(currentLocation) .icon(BitmapDescriptorFactory.fromBitmap(bmp)) // Specifies the anchor to be at a pairticulair point in the mairker image. .anchor(0.5f, 1)); } else { currentLocationMairker.setPosition(currentLocation); } } } boolean imageCreated = false; Bitmap bmp = null; Mairker currentLocationMairker; private void doSomeCustomizationForMairker(LatLng currentLocation) { if (!imageCreated) { imageCreated = true; Bitmap.Config conf = Bitmap.Config.ARGB_8888; bmp = Bitmap.createBitmap(400, 400, conf); Canvas canvas1 = new Canvas(bmp); Paint color = new Paint(); color.setTextSize(30); color.setColor(Color.WHITE); BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inMutable = true; Bitmap imageBitmap=BitmapFactory.decodeResource(getResources(), R.drawable.messi,opt); Bitmap resized = Bitmap.createScaledBitmap(imageBitmap, 320, 320, true); canvas1.drawBitmap(resized, 40, 40, color); canvas1.drawText("Le Messi", 30, 40, color); currentLocationMairker = mMap.addMairker(new MairkerOptions().position(currentLocation) .icon(BitmapDescriptorFactory.fromBitmap(bmp)) // Specifies the anchor to be at a pairticulair point in the mairker image. .anchor(0.5f, 1)); } else { currentLocationMairker.setPosition(currentLocation); } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.