Back to project page interamap.
The source code is released under:
MIT License
If you think the Android project interamap listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.richso.interamap.adapter; /* www. j a va 2 s . co m*/ import android.graphics.Color; import android.support.v4.app.FragmentActivity; import android.text.SpannableString; import android.text.style.ForegroundColorSpan; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.Marker; import com.richso.interamap.R; import com.richso.interamap.utils.Constant; /** * Created with IntelliJ IDEA. * User: nikolai * Date: 9/19/13 * Time: 4:58 PM * To change this template use File | Settings | File Templates. */ public class MarkerInfoAdapter implements GoogleMap.InfoWindowAdapter{ private View mWindow; private View mContent; public MarkerInfoAdapter(FragmentActivity activity) { mWindow = activity.getLayoutInflater().inflate(R.layout.custom_info_window, null); mContent = activity.getLayoutInflater().inflate(R.layout.custom_info_content, null); } @Override public View getInfoWindow(Marker marker) { render(marker, mWindow); return mWindow; } @Override public View getInfoContents(Marker marker) { render(marker, mContent); return mContent; } private void render(Marker marker, View view) { ((ImageView) view.findViewById(R.id.badge)).setImageResource(R.drawable.ic_launcher); String title = marker.getTitle(); TextView titleUi = (TextView) view.findViewById(R.id.title); if ( title != null && !title.equals(Constant.NONE) ) { SpannableString titleText = new SpannableString(title); titleText.setSpan(new ForegroundColorSpan(Color.RED), 0, titleText.length(), 0); titleUi.setText(titleText); } else { titleUi.setText(""); } String snippet = marker.getSnippet(); TextView snippetUi = (TextView) view.findViewById(R.id.snippet); if( snippet != null && !snippet.equals(Constant.NONE) ) { SpannableString snippetText = new SpannableString(snippet); snippetText.setSpan(new ForegroundColorSpan(Color.BLUE), 0, snippet.length(), 0); snippetUi.setText(snippetText); } else { snippetUi.setText(""); } } }