void setSatellite(boolean on)
void setTraffic(boolean on)
void setStreetView(boolean on)
//通过ToggleButton来开/关卫星视图功能
satellite_switch_button = (ToggleButton) findViewById(R.id.button_satellite);
satellite_switch_button.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked) {
map.setSatellite(true);
} else {
map.setSatellite(false);
}
}
});
XML文件中配置:
<ToggleButton
android:id="@+id/button_satellite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="卫星视图(开)"
android:textOff="卫星视图(关)"
/>