Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android上的谷歌地图工具栏不显示_Android_Google Maps_Maps_Toolbar - Fatal编程技术网

Android上的谷歌地图工具栏不显示

Android上的谷歌地图工具栏不显示,android,google-maps,maps,toolbar,Android,Google Maps,Maps,Toolbar,我正在使用GoogleMapsAPI,并为标记创建了一个自定义信息窗口 我需要显示工具栏地图,但使用此方法 map.getUiSettings().setMapToolbarEnabled(true); 当我单击标记时,它将显示在我的信息窗口中,而不是工具栏上 我希望在单击标记时显示工具栏 下面是我的代码: @覆盖 4月1日公开作废(谷歌地图谷歌地图){ mMap=谷歌地图; mMap.getUiSettings().setMapToolbarEnabled(true); mMap.setO

我正在使用GoogleMapsAPI,并为标记创建了一个自定义信息窗口

我需要显示工具栏地图,但使用此方法

map.getUiSettings().setMapToolbarEnabled(true);
当我单击标记时,它将显示在我的信息窗口中,而不是工具栏上

我希望在单击标记时显示工具栏

下面是我的代码:

@覆盖
4月1日公开作废(谷歌地图谷歌地图){
mMap=谷歌地图;
mMap.getUiSettings().setMapToolbarEnabled(true);
mMap.setOnMarkerClickListener(此);
mMap.setOnInfoWindowClickListener(新的GoogleMap.OnInfoWindowClickListener(){
@凌驾
公用无效信息窗口单击(标记){
MarkerCouple idtype=(MarkerCouple)marker.getTag();
if(idtype.getType()==ResourceType.EVENTS
&¤tEvents.get(idtype.getID())!=null){
资源=当前资源
.get(currentEvents.get(idtype.getID()).getRes_ID());
Events event=currentEvents.get(idtype.getID());
意图i=新意图(MainActivity.this、ShowEventActivity.class);
i、 putExtra(Variable.USER_JSON,USER.toJSON());
i、 putExtra(Variable.EVENT_JSON,EVENT.toJSON());
i、 putExtra(Variable.resourceu JSON,resources.toJSON());
startActivityForResult(i,变量.SHOW_事件);
}
if(idtype.getType()==ResourceType.PLACES
&¤tPlaces.get(idtype.getID())!=null){
资源=当前资源
.get(currentPlaces.get(idtype.getID()).getRes_ID());
Places-place=currentPlaces.get(idtype.getID());
意图i=新意图(MainActivity.this、ShowPlaceActivity.class);
i、 putExtra(Variable.USER_JSON,USER.toJSON());
i、 putExtra(Variable.PLACE_JSON,PLACE.toJSON());
i、 putExtra(Variable.resourceu JSON,resources.toJSON());
startActivityForResult(i,变量。显示位置);
}
}
});
mMap.setInfoWindowAdapter(新的GoogleMap.InfoWindowAdapter(){
@凌驾
公共视图getInfoWindow(标记器){
视图v=GetLayoutFlater()。充气(R.layout.marker\u预览,空);
ImageView m=(ImageView)v.findViewById(R.id.marker_图像);
m、 setImageBitmap(Bitmap.createScaledBitmap(imageToShow,600400,true));
返回v;
}
@凌驾
公共视图getInfoContents(标记器){
返回null;
}
});
新建MarkerAsync().execute();
}
@凌驾
公共布尔onMarkerClick(最终标记){
MarkerCouple idtype=(MarkerCouple)marker.getTag();
if(idtype.getType()==ResourceType.EVENTS&¤tEvents.get(idtype.getID())!=null){
Events event=currentEvents.get(idtype.getID());
final Resources=currentResources.get(event.getRes_ID());
Picasso.with(MainActivity.this).invalidate(Variable.DOWNLOAD_URL+resources.getURI());
新建异步任务(){
@凌驾
受保护的Void doInBackground(Void…参数){
试一试{
imageToShow=Picasso.with(MainActivity.this).load(Variable.DOWNLOAD_URL+resources.getURI()).get();
}捕获(IOE异常){
e、 printStackTrace();
}
返回null;
}
@凌驾
受保护的void onPostExecute(void v){
marker.showInfoWindow();
}
}.execute();
}
if(idtype.getType()==ResourceType.PLACES&¤tPlaces.get(idtype.getID())!=null){
Places-place=currentPlaces.get(idtype.getID());
final Resources=currentResources.get(place.getRes_ID());
Picasso.with(MainActivity.this).invalidate(Variable.DOWNLOAD_URL+resources.getURI());
Picasso.with(MainActivity.this).invalidate(Variable.DOWNLOAD_URL+resources.getURI());
新建异步任务(){
@凌驾
受保护的Void doInBackground(Void…参数){
试一试{
imageToShow=Picasso.with(MainActivity.this).load(Variable.DOWNLOAD_URL+resources.getURI()).get();
}捕获(IOE异常){
e、 printStackTrace();
}
返回null;
}
@凌驾
受保护的void onPostExecute(void v){
marker.showInfoWindow();
}
}.execute();
}
返回true;
}

只是
返回false从您的
onMarkerClick()

发件人:

MarkerClick上的公共抽象布尔值(标记标记)

返回

如果侦听器已使用该事件(即,不应发生默认行为),则为true,否则为false(即,应发生默认行为)。默认行为是相机移动到标记处,并显示一个信息窗口


请发布您的代码如果我返回false,我抛出异常什么是异常?java.lang.NullPointerException:尝试在android.graphics.Bitmap.createScaledBitmap(Bitmap.java:591)的空对象引用上调用虚拟方法“int android.graphics.Bitmap.getWidth()”