1 回答

TA貢獻(xiàn)1798條經(jīng)驗 獲得超3個贊
您需要生成一個 Google Maps API 密鑰。
放置一個 ImageView 并將此 URL 加載到該 ImageView 中:
https://maps.google.com/maps/api/staticmap?center=latitude,longitude&zoom=15&size=1280x720&sensor=false&markers=latitude,longitude&key=YOUR_API_KEY
在你的按鈕上OnClickListener():
String uri = String.format(Locale.ENGLISH, "geo:%f,%f?q=%f,%f",
latitude,
longitude,
latitude,
longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
這會將 Google 地圖應(yīng)用程序打開到這些坐標(biāo)。
添加回答
舉報