Commit be9d91e9 authored by Qiu Xiang's avatar Qiu Xiang

调整默认定位模式

parent d732554b
package cn.qiuxiang.react.amap3d; package cn.qiuxiang.react.amap3d;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import com.amap.api.maps.AMap; import com.amap.api.maps.AMap;
import com.amap.api.maps.MapView; import com.amap.api.maps.MapView;
import com.amap.api.maps.UiSettings; import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.MyLocationStyle;
public class AMapView extends MapView { public class AMapView extends MapView {
public final AMap map; public final AMap map;
public final UiSettings ui; public final UiSettings ui;
public final MyLocationStyle locationStyle;
public AMapView(Context context) { public AMapView(Context context) {
super(context); super(context);
super.onCreate(null); super.onCreate(null);
map = this.getMap(); map = this.getMap();
ui = map.getUiSettings(); ui = map.getUiSettings();
locationStyle = new MyLocationStyle();
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
map.setMyLocationStyle(locationStyle);
} }
} }
...@@ -30,9 +30,6 @@ class AMapViewManager extends SimpleViewManager<AMapView> { ...@@ -30,9 +30,6 @@ class AMapViewManager extends SimpleViewManager<AMapView> {
@ReactProp(name = "locationEnabled") @ReactProp(name = "locationEnabled")
public void setMyLocationEnabled(AMapView view, boolean enabled) { public void setMyLocationEnabled(AMapView view, boolean enabled) {
MyLocationStyle locationStyle = new MyLocationStyle();
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_SHOW);
view.map.setMyLocationStyle(locationStyle);
view.map.setMyLocationEnabled(enabled); view.map.setMyLocationEnabled(enabled);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment