
回复
1.在项目根目录下的build.gradle文件中,
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
2.在entry模块的build.gradle文件中,
dependencies {
implementation('com.gitee.chinasoft_ohos:chinamapview:1.0.0')
implementation('com.gitee.chinasoft_ohos:ohos-colorpicker:1.0.0')
......
}
在sdk6,DevEco Studio2.2 Beta1 下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
布局文件中引入ChinaMapView
<com.noteam.chinamapview.HVScaleScrollView
ohos:id="$+id:scrollView"
ohos:width="match_parent"
ohos:height="450vp"
ohos:layout_alignment="center">
<DirectionalLayout
ohos:id="$+id:rl_map"
ohos:width="match_parent"
ohos:height="450vp"
>
<com.noteam.chinamapview.ChinaMapView
ohos:id="$+id:mapView"
ohos:width="match_parent"
ohos:height="450vp"
ohos:layout_alignment="center"
/>
</DirectionalLayout>
</com.noteam.chinamapview.HVScaleScrollView>
ChinaMapView 地图绘制主view, HVScaleScrollView是地图手势缩放的辅助类
1. 通过Id获取组件
mapView = (ChinaMapView) findComponentById(ResourceTable.Id_mapView);
2. 设置是否缩放
mapView.setOnlyClick(isChecked); //isChecked 为false不缩放、ture 缩放
使用colorPicker
打开diolog样式的着色器
new ColorPickerPopup.Builder(this)
.initialColor(Color.RED.getValue())
.enableBrightness(true)
.enableAlpha(true)
.okTitle("确定")
.cancelTitle("取消")
.showIndicator(true)
.showValue(true)
.setButtonClickListener(new ColorPickerPopup.ButtonClickListener() {
@Override
public void okClick(int color) {
mapView.setProvinceColor(color);
}
@Override
public void cancelClick() {
}
})
.build()
.show(myLayout, new ColorPickerPopup.ColorPickerObserver() {
@Override
public void onColorPicked(int color) {
}
});
MapView一些设置color的公共方法
method | 参数类型 | 说明 |
---|---|---|
setUnSelectBorderColor | int color | 设置未选中省份的边框颜色 |
setSelectBorderColor | int color | 修改选中省份的边框颜色 |
setProvinceColor | int color | 修改省份的颜色 |
isShowCityName | boolean color | 是否显示省份名称 |
setColorChangeListener | interface ColorChangeListener | 着色器颜色选择监听 |
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
Copyright (c) [2018] [static]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.