我正在开发我的应用程序中的Google地图,但它没有显示地图只显示网格线,请任何人都帮我解决问题是什么? 而且,当两个以上的气泡位于相同的地方时,我正在将文字绘制在气泡上,在这种情况下,文本会相互重叠。 更改API键后将显示地图,但我的第二个问题仍然存在。我必须在地图和文本(该气泡上的属性的大小)上绘制气泡,假设列表4的大小然后4应该在气泡上绘制。已经实现了这些,但没有任何愿望输出显示出来。 当超过2财产上的同一位置都有2个以上列表的大小,然后在文本泡overlapp海誓山盟对不起我的解释,我使用此代码 -为什么在Google地图中只显示网格线?
drawable = this.getResources().getDrawable(R.drawable.bluedot);
drawable1 = this.getResources().getDrawable(R.drawable.bluedot_large);
overlay = new GoogleMapViewOverlay(drawable,mapView,activity);
// GoogleMapViewOverlay方法为: -
public GoogleMapViewOverlay(Drawable drawable, MapView mapView,
Activity activity2)
{
//super(drawable);
super(boundCenterBottom(drawable));
setLastFocusedIndex(-1);
populate();
arrayList1 = new ArrayList<Applicationdataset>() ;
items = new ArrayList<OverlayItem>();
marker = drawable;
mContext = mapView.getContext();
mc = mapView.getController();
this.activity = activity2;
DB = new DatabaseHelper(activity2);
}
//添加项目作为
if(point != null)
{
if(arrayList.get(i).getUnitstotal().equalsIgnoreCase("1"))
{
oi = overlay.createItem(i);
System.out.println("listing when 1 value is"+arrayList.get(i).getUnitstotal());
overlay.addItem(oi);
}
else if(!arrayList.get(i).getUnitstotal().equalsIgnoreCase("1"))
{
oi = overlay.createItem(i);
System.out.println("listing when more value is "+ arrayList.get(i).getUnitstotal());
if(overlay!=null)
{
overlay.addItem(oi);
//overlay.draw(canvas, mapView, shadow);
}
}
}
//画法文本笼络气泡
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when)
{
super.draw(canvas, mapView, false);
arrayList1 = arrayList;
for (int index = 0; index < items.size(); index++)
{
OverlayItem item = items.get(index);
GeoPoint point = item.getPoint();
Point ptScreenCoord = new Point();
mapView.getProjection().toPixels(point, ptScreenCoord);
//Paint
Paint paint = new Paint();
paint.setStyle(Style.STROKE);
paint.setTextAlign(Paint.Align.CENTER);
paint.setTypeface((Typeface.defaultFromStyle(Typeface.BOLD)));
paint.setTextSize(20);
paint.setColor(Color.WHITE);
paint.setFilterBitmap(false);//true
if(arrayList.get(index).getUnitstotal().equalsIgnoreCase("1"))
canvas.drawText("", ptScreenCoord.x, ptScreenCoord.y-20,paint);
else
{
canvas.drawText(arrayList.get(index).getUnitstotal().toString(), ptScreenCoord.x, ptScreenCoord.y-40, paint);
}
}
return true;
}
您使用的是正确的地图API密钥? – Habib
我正在生成新的API密钥,然后请参阅.. – sandee
http://stackoverflow.com/questions/2641197/android-app-google-maps-showing-grey-tiles-and-not-map – Habib