2012-06-19 65 views
0

我正在開發我的應用程序中的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; 
    } 
+0

您使用的是正確的地圖API密鑰? – Habib

+0

我正在生成新的API密鑰,然後請參閱.. – sandee

+0

http://stackoverflow.com/questions/2641197/android-app-google-maps-showing-grey-tiles-and-not-map – Habib

回答

相關問題