android studio中带底部导航的谷歌地图
我正在安卓工作室开发安卓谷歌地图项目。我有一个MapActivity来显示位置(代码:) 我的布局是这样的:android studio中带底部导航的谷歌地图,android,google-maps,bottomnavigationview,Android,Google Maps,Bottomnavigationview,我正在安卓工作室开发安卓谷歌地图项目。我有一个MapActivity来显示位置(代码:) 我的布局是这样的: <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:tools="ht
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
当应用程序运行时,地图显示正确,但我想用底部导航显示如下图所示的地图。选择地图按钮时,地图将显示。
当前代码有什么问题?我如何才能将底部导航添加到此代码?您是否尝试过添加它?我尝试过,并创建底部导航布局和类(主活动),但我不知道如何链接类(mapactivity和主活动)在底部导航按钮中显示地图。代替活动,将地图代码移动到碎片当前代码有什么问题?我如何才能将底部导航添加到此代码中???您尝试过添加吗?我尝试过,并创建底部导航布局和类(主活动),但我不知道如何链接类(mapactivity和主活动)要在底部导航按钮中显示地图,请将地图代码移动到片段,而不是“活动”
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />