ウェブでたくさん検索しましたが、質問に答えるものは見つかりませんでした。MyLocationを有効にすると
gmap.setMyLocationEnabled(true)
地図を現在地の中央に配置するためのボタンが自動的に表示されます。私はそれを削除したいので、これを行う方法をあなたに尋ねています。誰かが私を助けてくれることを願っています!
ウェブでたくさん検索しましたが、質問に答えるものは見つかりませんでした。MyLocationを有効にすると
gmap.setMyLocationEnabled(true)
地図を現在地の中央に配置するためのボタンが自動的に表示されます。私はそれを削除したいので、これを行う方法をあなたに尋ねています。誰かが私を助けてくれることを願っています!
GoogleMap
オブジェクトで次のメソッドを呼び出した後:
map.setMyLocationEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(false);
現在の場所のインジケーター(青い円)が表示されますが、地図をその場所の中央に配置するためのコントロールはありません。
それは非常に簡単な答えです;
gmap.setMyLocationEnabled(true); ==> means "to center the map on my current location"
gmap.setMyLocationEnabled(false); ==> means "NOT to center the map on my current location"
[アップデート]
マップ上のロケーションボタンを削除する場合は、コードで以下を検索して削除してください。
public void setMyLocationButtonEnabled(View v) {
if (!checkReady()) {
return;
}
// Enables/disables the my location button (this DOES NOT enable/disable the my location
// dot/chevron on the map). The my location button will never appear if the my location
// layer is not enabled.
mUiSettings.setMyLocationButtonEnabled(((CheckBox) v).isChecked());
}
public void setMyLocationLayerEnabled(View v) {
if (!checkReady()) {
return;
}
// Enables/disables the my location layer (i.e., the dot/chevron on the map). If enabled, it
// will also cause the my location button to show (if it is enabled); if disabled, the my
// location button will never show.
mMap.setMyLocationEnabled(((CheckBox) v).isChecked());
}
このようなことを試しましたか?
<fragment xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/backgroundMap"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:uiZoomControls="false"
map:uiCompass="false"
class="com.google.android.gms.maps.SupportMapFragment"/>
マーカーに関連するUIを除いて、マップからすべてのデフォルトUIを効果的に削除します。詳細については、このリンクを確認してください。
編集
OPのコメントに返信して、idは、Google Maps APIに引き継がせる代わりに、カスタムロケーションアルゴリズムを使用することをお勧めします。私は以前にそれを行いましたが、それほど苦痛ではありません。地図上にマーカーを置いてユーザーに自分の居場所を知らせ、マーカーをドラッグ可能にして、ユーザーが手動で位置を調整できるようにします。
このリンクを確認してください。