У меня есть этот макет в XML.И когда я запускаю упражнение внизу, ничего не появляется, кроме кнопок.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="fill_parent">
<Button
android:id="@+id/sat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Satellite"
android:onClick="myClickHandler"
android:padding="8px"/>
<Button
android:id="@+id/street"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Street"
android:onClick="myClickHandler"
android:padding="8px"/>
<Button
android:id="@+id/traffic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Traffic"
android:onClick="myClickHandler"
android:padding="8px"/>
<Button
android:id="@+id/normal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Normal"
android:onClick="myClickHandler"
android:padding="8px"/>
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:apiKey=
/>
</LinearLayout>
По какой-то причине единственное, что я вижу, это кнопки вверху.карта не отображается, когда моя активность запускается.
Вот мой код в MapActivity.
public class meeting_map extends MapActivity{
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.mapview);
mapView = (MapView)findViewById(R.id.mapView);
mapView.setBuiltInZoomControls(true);
}
public void myClickHandler(View target){
switch(target.getId()){
case R.id.sat:
mapView.setSatellite(true);
break;
case R.id.street:
mapView.setStreetView(true);
break;
case R.id.traffic:
mapView.setTraffic(true);
break;
case R.id.normal:
mapView.setSatellite(false);
mapView.setTraffic(false);
mapView.setStreetView(false);
break;
}
}
@Override
protected boolean isLocationDisplayed(){
return false;
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Может быть, я что-то упустил.