1

take a look at this image how the InfoWindow appears and its different then the one google provides i think?

enter image description here

I am searching for a text box like this with no tooltip arrow. when i checked android google maps feature it looks like this:

sample googleMap snippet, notice the arrow

How would i hide the arrow? i've like to change the anchorpoint to be the left top of the textbox also. is this all customization ?

j2emanue
  • 60,549
  • 65
  • 286
  • 456
  • I do not know anything about Snippet . But this is the same case with Info Window on Map.. When you use a Custom Layout for `InfoWindow` the arrow will not appear. Check if there is an option for using a Custom layout for Snippet too . – ADM Jul 03 '19 at 03:53
  • 1
    i think you have to make it custom message layout. and show and hide it according to your need on google maps. – unzila Jul 03 '19 at 04:53

2 Answers2

1

this is really easy to do with iconGenerator from google map util library:

 val iconGenerator = IconGenerator(activity)
    val window = activity.layoutInflater.inflate(R.layout.myinfo_window,null)
    iconGenerator.setContentView(window)
    iconGenerator.setBackground(activity.getDrawableCompat(R.drawable.mybox_bg))
    return googleMap.addMarker(MarkerOptions()
            .position(location)
            .icon(BitmapDescriptorFactory.fromBitmap(iconGenerator.makeIcon())))

myinfo_window.xml then looks like this:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:padding="13dp"
android:layout_height="wrap_content">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Cool LOCATION"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"/>

</android.support.constraint.ConstraintLayout>

note: R.drawable.mybox_bg is a 9 patch drawable.

j2emanue
  • 60,549
  • 65
  • 286
  • 456
0

You can easily add info window to google map.

static final LatLng MELBOURNE = new LatLng(-37.81319, 144.96298); Marker melbourne = mMap.addMarker(new MarkerOptions() .position(MELBOURNE) .title("Melbourne")); melbourne.showInfoWindow();

Sumit Kumawat
  • 127
  • 10