2011-09-16 41 views
2

我嘗試在地圖視圖上顯示交通信息,但沒有顯示任何內容,但它與本地地圖應用程序完全一致(對於相同的位置)。android mapview交通信息

這裏是我的代碼:

public class Main extends MapActivity 
{ 
    private MapView map = null; 

/** Called when the activity is first created. */ 
@Override 
public void onCreate(Bundle savedInstanceState) { 

    super.onCreate(savedInstanceState); 

    LinearLayout ll = new LinearLayout(this); 
    ll.setOrientation(LinearLayout.VERTICAL); 

    map = new MapView(this,"XXXX"); 
    map.setEnabled(true); 
    map.setClickable(true); 
    map.setBuiltInZoomControls(true); 
    map.setTraffic(true); 

    ll.addView(map, new LinearLayout.LayoutParams(
     LayoutParams.FILL_PARENT, 
     LayoutParams.FILL_PARENT)); 
    setContentView(ll); 
} 
+0

你在模擬器或設備上運行它嗎? –

+0

二者,相同的結果 – Arutha

+0

請定義「沒有顯示」。你有沒有得到任何地圖瓷磚?如果你離開'setTraffic(true)'調用,你會得到任何地圖切片嗎? – CommonsWare

回答

0

你必須在沒有多少交通信息的區域。嘗試在美國瀏覽,看看你是否在那裏看到一些交通信息?