MapActivity があります。トラフィックを表示するために適切な場所とズーム レベルに設定されている場合、最初に作成された後、マップを操作 (クリック、ドラッグなど) してトラフィックが表示されるまで、何も表示されません。当然、ロード後にユーザーの操作なしでトラフィックが表示されるようにしたいのですが、それをトリガーする方法がわかりません。何か案は?
私のMapActivity継承クラスから:
private MapView mapView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.setTraffic(true);
}
そして、これが R.layout.map の内容です
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainlayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="...MY API KEY HERE..."
/>
</RelativeLayout>