2017-05-13 50 views

回答

0

使用映射对象调用map.setlocationEnabled(真);

0

为了在地图上显示

SupportMapFragment supportMapFragment =(SupportMapFragment)getSupportFragmentManager()findFragmentById(R.id.map_fragment)位置按钮。 supportMapFragment.getMap()。getUiSettings()。setZoomControlsEnabled(false); supportMapFragment.getMap()。getUiSettings()。setMyLocationButtonEnabled(true); supportMapFragment.getMap()。setMyLocationEnabled(true);

你也可以改变按钮位置。 (View)supportMapFragment.getView()。findViewById(Integer.parseInt(“1”))。getParent())。findViewById(Integer.parseInt(“2”)); RelativeLayout.LayoutParams rlp =(RelativeLayout.LayoutParams)locationButton.getLayoutParams();上右底部 rlp.addRule //位置(RelativeLayout.ALIGN_PARENT_TOP,0); rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,RelativeLayout.TRUE); rlp.setMargins(0,0,180,80);