java - 在不使用 fragment 的情况下在 Android 中显示 Google map ?

标签 java android android-layout android-fragments google-maps-android-api-2

<分区>

我看过使用 Fragment 将 Google map 嵌入 Android 的教程。但是在Layout 和Java 中如何不使用fragment 来显示 map 呢?

最佳答案

Use MapView .引用 the documentation :

MapView, a subclass of the Android View class, allows you to place a map in an Android View. A View represents a rectangular region of the screen, and is a fundamental building block for Android applications and widgets. Much like a MapFragment, the MapView acts as a container for the map, exposing core map functionality through the GoogleMap object.

Users of this class must forward all the activity life cycle methods - such as onCreate(), onDestroy(), onResume(), and onPause() - to the corresponding methods in the MapView class.

关于java - 在不使用 fragment 的情况下在 Android 中显示 Google map ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28543117/

相关文章:

java - 升级到 Hibernate 4.3.4 主要方法永远不会终止 JVM 未完成

Unix 的 Java 包装器无法在当前目录之外工作

Android Studio 3.0 - 无法保存设置 : Failed to save settings. 请重启 Android Studio

android - 使用android数据绑定(bind)将数据从Recycler View onClick传递到Detail Activity

android - TextInputLayout 密码切换从中心移动文本

JAVA 警告 - 取消引用可能的空指针。我如何正确摆脱这个警告?

java - 无法从警报对话框中的评级栏获取值

android - 未生成 Crashlytics 映射文件

android - 如何在 Android 中创建始终处于顶部的全屏覆盖 Activity

android - TextView 未出现在模拟器和真实设备上