所以我以编程方式将谷歌添加到我的应用程序中,它工作得很好,但我不知道如何在地图上添加按钮或选项,例如切换地图类型、搜索位置等。这是我当前的代码:
public class GoogleMaps extends FragmentActivity {
SupportMapFragment mMapFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_google_maps);
mMapFragment = new SupportMapFragment(){
@Override
public void onActivityCreated(Bundle savedInstanceState){
super.onActivityCreated(savedInstanceState);
GoogleMap map = mMapFragment.getMap();
map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
map.setMyLocationEnabled(true);
if (map != null){
UiSettings settings = map.getUiSettings();
settings.setTiltGesturesEnabled(false);
}
}
};
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, mMapFragment).commit();