我一直在使用Android GoogleMapApi而且我的烦恼发现我无法为InfoWindow上的选择器设置drawable。我想知道是否有类似于ListView或变通方法的XML属性。
class InfoAdapter implements InfoWindowAdapter
{
@Override
public View getInfoContents(Marker m) {
View layout = getLayoutInflater().inflate(R.layout.mapsight, null);
TextView tv = (TextView) layout.findViewById(R.id.mapsighttext);
ImageView iv = (ImageView) layout.findViewById(R.id.smallmappic);
JSONObject j = locList.get(Integer.parseInt(m.getSnippet())).j;
int drawable = 0;
try {
drawable = getResources().getIdentifier(Utils.removeFileType(j.getString("bigpic")).toLowerCase(), "drawable", getPackageName());
} catch (JSONException e) {
e.printStackTrace();
}
if (drawable != 0) iv.setImageResource(drawable);
else
{
}
tv.setText(m.getTitle());
return layout;
}
@Override
public View getInfoWindow(Marker m) {
return null;
}
}
...
googleMap.setInfoWindowAdapter(new InfoAdapter());
感谢您提供任何帮助