Skip to content Skip to sidebar Skip to footer

Google Maps: Can You Make String Inside Snippet Bold?

I have for a while been trying to make a custom info window that shows sensor data. My problem before was that I never solved how to make different info windows for different marke

Solution 1:

You can create your own custom info window and style the contents.

custom_info.xml

<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:background="#fff"android:padding="10dp"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"><TextViewandroid:textColor="@color/black"android:id="@+id/title"android:textStyle="bold"android:layout_width="wrap_content"android:layout_height="wrap_content" /><TextViewandroid:textColor="@color/black"android:id="@+id/snippet"android:textStyle="bold"android:layout_width="wrap_content"android:layout_height="wrap_content" /></LinearLayout>

and then creating the custom info window as below

googlemap.setInfoWindowAdapter(newGoogleMap.InfoWindowAdapter() {
@OverridepublicViewgetInfoWindow(Marker arg0) {
        View v = getLayoutInflater().inflate(R.layout.custom_info, null);
        TextView title= (TextView) v.findViewById(R.id.title);
        TextView snippet= (TextView) v.findViewById(R.id.snippet);
        title.setText("your value");
        snippet.setText("your value");
        return v;
        }
@OverridepublicViewgetInfoContents(Marker arg0) {
        returnnull;

        }
        });

markerOptions.showInfoWindow();

Post a Comment for "Google Maps: Can You Make String Inside Snippet Bold?"