解决地图样式没有更新问题
This commit is contained in:
@@ -183,48 +183,46 @@ public class SmallMapDirectionView extends RelativeLayout {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// 判断是否有样式文件存在
|
// 判断是否有样式文件存在
|
||||||
File styleExit = new File(styleFilePath);
|
//File styleExit = new File(styleFilePath);
|
||||||
if (!styleExit.exists()) {
|
FileUtils.copy(
|
||||||
FileUtils.copy(
|
context.getAssets().open("small_map_style.data"),
|
||||||
context.getAssets().open("small_map_style.data"),
|
styleFilePath,
|
||||||
styleFilePath,
|
new FileUtils.FileCopyListener() {
|
||||||
new FileUtils.FileCopyListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
Log.w("FileCopyListener", "onStart=");
|
Log.w("FileCopyListener", "onStart=");
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFail(Exception e) {
|
|
||||||
Log.w("FileCopyListener", "onFail=");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onProcess(int process) {
|
|
||||||
Log.w("FileCopyListener", "onProcess=" + process);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFinish(String toPath) {
|
|
||||||
Log.w("FileCopyListener", "onFinish toPath=" + toPath);
|
|
||||||
|
|
||||||
// 高德地图有bug,所以需要多次调用设置皮肤才能成功
|
|
||||||
if (options != null) {
|
|
||||||
options.setCustomMapStylePath(styleFilePath);
|
|
||||||
mAMapNaviView.setViewOptions(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
//设置希望展示的地图缩放级别
|
|
||||||
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
|
||||||
aMap.moveCamera(cameraUpdate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
@Override
|
||||||
|
public void onFail(Exception e) {
|
||||||
|
Log.w("FileCopyListener", "onFail=");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProcess(int process) {
|
||||||
|
Log.w("FileCopyListener", "onProcess=" + process);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish(String toPath) {
|
||||||
|
Log.w("FileCopyListener", "onFinish toPath=" + toPath);
|
||||||
|
|
||||||
|
// 高德地图有bug,所以需要多次调用设置皮肤才能成功
|
||||||
|
if (options != null) {
|
||||||
|
options.setCustomMapStylePath(styleFilePath);
|
||||||
|
mAMapNaviView.setViewOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置希望展示的地图缩放级别
|
||||||
|
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||||
|
aMap.moveCamera(cameraUpdate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user