2017-05-13 93 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);