![](/img/trans.png)
[英]Floating action button not visible over the Google Map in Android Studio
[英]Navigation button not visible in google map android
当我们在google map android中使用自己的凭据调用导航意图时,导航按钮不可见。
这是我在活动中调用的代码。
public void NavigatePath(){
Uri gmmIntentUri = Uri.parse("http://maps.google.com/maps?" + "saddr=" + Sourcelat + "," + Sourcelong + "&daddr=" + Destinationlat + "," + Destinationlong);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
请向我推荐如何显示导航按钮。
我正在使用它,它工作正常:
String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", sourceLatitude, sourceLongitude, destinationLatitude, destinationLongitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
try
{
startActivity(intent);
}
catch(ActivityNotFoundException ex)
{
try
{
Intent unrestrictedIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(unrestrictedIntent);
}
catch(ActivityNotFoundException innerEx)
{
Toast.makeText(this, "Please install google maps application!", Toast.LENGTH_LONG).show();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.