0
enter code here
如何把地圖信息窗口上的按鈕,使可點擊的,我想下面的代碼: -我們怎樣才能把地圖信息窗口上的按鈕,使點擊
`enter code here`if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
googleMap.animateCamera(CameraUpdateFactory.zoomTo(11.0f));
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
} else {
// final Get_Preference_model item =
// this.countryList.get(position);
for(int i=0;i<countryList.size();i++)
{
sfLatLng = new LatLng(Double.parseDouble(countryList.get(i).latitude),Double.parseDouble(countryList.get(i).longitude));
//sfLatLng = new LatLng(dblatt, dblong);
String buname = countryList.get(i).deal_id+"-"+countryList.get(i).deal_name;
Marker marker = googleMap.addMarker(new MarkerOptions()
.position(sfLatLng)
.title(buname)
.snippet(countryList.get(i).deal_description)
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.imgmapfullredpin)));
dlid = countryList.get(i).deal_id;
dlname = countryList.get(i).deal_name;
catname = countryList.get(i).category_name;
dldesc = countryList.get(i).deal_description;
distan = countryList.get(i).distance;
retailadd = countryList.get(i).retailer_address;
dllat = countryList.get(i).latitude;
dllng = countryList.get(i).longitude;
totdeal = countryList.get(i).totdeals;
}
googleMap.setInfoWindowAdapter(new InfoWindowAdapter() {
public View getInfoWindow(Marker m1) {
View v = getLayoutInflater().inflate(
R.layout.balloon_map_overlay, null);
TextView tite = (TextView) v
.findViewById(R.id.textView2);
TextView snip = (TextView) v
.findViewById(R.id.textView3);
if (m1.getTitle() != null) {
String str=m1.getTitle();
String[] strsg = str.split("-");
System.out.println(strsg[0]);
strpassid=strsg[0].toString();
System.out.println(strsg[1]);
tite.setText(strsg[1]);
//tite.setText(m1.getTitle());
}
if (m1.getSnippet() != null) {
String strh=m1.getSnippet();
System.out.println(strh);
snip.setText(m1.getSnippet());
//snip.setText(m1.getSnippet());
}
return v;
}
public View getInfoContents(Marker marker) {
return null;
}
});
googleMap
.setOnCameraChangeListener(new OnCameraChangeListener() {
public void onCameraChange(CameraPosition arg0) {
googleMap.animateCamera(CameraUpdateFactory
.newLatLng(sfLatLng));
googleMap.setOnCameraChangeListener(null);
}
});
googleMap
.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
public void onInfoWindowClick(Marker item) {
// TODO Auto-generated method stub
Intent viewdeal = new Intent(
getApplicationContext(), ViewDealMap.class);
viewdeal.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
viewdeal.putExtra("dealid", strpassid);
startActivity(viewdeal);
overridePendingTransition(
R.anim.slide_in_right,
R.anim.slide_out_left);
}
});
}
}}
感謝您的及時答覆,但我想點擊按鈕事件是獨立的,當我在我的情況下,點擊信息窗口的..點擊按鈕然後信息窗口點擊作品...但我想c舔信息窗口的按鈕 – user3222296