aiceking / chinamapview Goto Github PK
View Code? Open in Web Editor NEW自定义View,可缩放、可平移、可点击的**地图,有**地图的全部省份,具备每个省份的点击接口
自定义View,可缩放、可平移、可点击的**地图,有**地图的全部省份,具备每个省份的点击接口
请问 MyMapView 在放大或者移动的情况 下, 在 onDraw 方法中,重新绘制各个省份的时候,为什么直接 drawPath 就适配了当前的放大或者移动,而不用改变各个省份的 path 中的数据?
照着china svg格式重新用了一个svg,但是显示出来确是几条灰线,在电脑上显示正常,不确定是不是parser的问题,svg代码如下:
<title>日本</title> <style type="text/css"> #BG{ fill: lightskyblue; } #Hopporyodo{ fill: darkseagreen; } #Hokkaido{ fill: darkseagreen; } #Aomori{ fill: darkseagreen; } #Iwate{ fill: darkseagreen; } #Miyagi{ fill: darkseagreen; } #Akita{ fill: darkseagreen; } #Yamagata{ fill: darkseagreen; } #Fukushima{ fill: darkseagreen; } #Ibaraki{ fill: darkseagreen; } #Tochigi{ fill: darkseagreen; } #Gumma{ fill: darkseagreen; } #Saitama{ fill: darkseagreen; } #Chiba{ fill: darkseagreen; } #Tokyo{ fill: darkseagreen; } #Kanagawa{ fill: darkseagreen; } #Nigata{ fill: darkseagreen; } #Toyama{ fill: darkseagreen; } #Ishikawa{ fill: darkseagreen; } #Fukui{ fill: darkseagreen; } #Yamanashi{ fill: darkseagreen; } #Nagano{ fill: darkseagreen; } #Gifu{ fill: darkseagreen; } #Shizuoka{ fill: darkseagreen; } #Aichi{ fill: darkseagreen; } #Mie{ fill: darkseagreen; } #Shiga{ fill: darkseagreen; } #Kyoto{ fill: darkseagreen; } #Osaka{ fill: darkseagreen; } #Hyogo{ fill: darkseagreen; } #Nara{ fill: darkseagreen; } #Wakayama{ fill: darkseagreen; } #Tottori{ fill: darkseagreen; } #Shimane{ fill: darkseagreen; } #Okayama{ fill: darkseagreen; } #Hiroshima{ fill: darkseagreen; } #Yamaguchi{ fill: darkseagreen; } #Tokushima{ fill: darkseagreen; } #Kagawa{ fill: darkseagreen; } #Ehime{ fill: darkseagreen; } #Kochi{ fill: darkseagreen; } #Fukuoka{ fill: darkseagreen; } #Saga{ fill: darkseagreen; } #Nagasaki{ fill: darkseagreen; } #Kumamoto{ fill: darkseagreen; } #Oita{ fill: darkseagreen; } #Miyazaki{ fill: darkseagreen; } #Kagoshima{ fill: darkseagreen; } #Okinawa{ fill: darkseagreen; } </style> <style type="text/css">
.land
{
fill: #CCCCCC;
fill-opacity: 1;
stroke:black;
stroke-opacity: 1;
stroke-width:1;
}
</style>
</defs>
<rect fill="lightskyblue" height="1600" id="BG" width="1400" x="0" y="0"/>
<path d="M 0 615 H 615 V 0" fill="none" id="AREA" stroke="gray" stroke-width="5px"/>
<!--<g stroke="black" stroke-width="3px"></g>-->
<!--<!– 北方領土 –>-->
<!--<g id="Hopporyodo" fill="white">-->
<!--<path d="M1270 196 l 8 0 4 -8 12 -7 2 -9 13 -14 3 -11 11 1 9 -8 16 -17 16 -11 7 0 5 -3 -1 -14 -4 1 -13 10 -11 11 -15 3 -8 -9 0 12 -11 11 -1 2 -8 3 -5 12 -6 4 -2 8 -8 3 3 10 -9 4 0 3 -4 1 1 4 -3 2 1 8 Z"/>-->
<!--<path d="M1194 258 l 6 5 3 0 0 -11 3 -5 7 -4 5 -9 2 -6 8 -6 2 -7 9 -3 7 -5 7 -4 2 -6 -9 3 -16 -5 -11 19 0 4 -5 3 -2 10 -6 5 -1 3 -11 13 Z"/>-->
<!--<path d="M1263 254 l 4 3 13 -9 -5 -5 -7 2 -5 5 Z"/>-->
<!--<path d="M1236 278 l 4 0 0 -5 -4 0 Z"/>-->
<!--</g>-->
<g fill="white" id="Hokkaido" title="北海道">
<path
class="land"
d="M 892 467 l 4 -1 0 -3 6 -5 6 -2 -1 -9 10 -8 4 -6 5 3 17 6 9 -8 -5 -7 -10 -3 -12 -14 -5 -1 -6 3 -9 -10 -4 -1 -4 -6 0 -3 3 -3 4 -12 4 -4 7 -1 6 1 5 4 7 8 4 7 5 0 4 -6 18 -12 24 -7 59 34 29 16 4 -12 0 -17 4 -12 5 -4 6 -11 28 -28 7 -5 11 1 3 2 15 -1 1 -8 3 -1 3 3 8 2 8 -9 2 -6 18 -5 4 -5 11 -9 0 -4 -5 -2 -8 10 -14 4 -2 -6 4 -1 -7 -17 5 2 0 -5 -9 -1 -5 -7 -1 -10 4 -20 7 -5 0 -15 -4 -1 -12 16 -7 8 -10 12 -13 1 -9 -3 -9 -12 -3 6 -5 -7 -16 4 -6 -4 0 -5 -13 -5 -24 -18 -17 -16 -13 -17 -16 -21 -14 -11 -12 -12 -3 0 0 5 -12 1 -3 5 1 10 -3 3 1 9 11 17 4 13 0 16 -2 13 -6 8 4 12 -1 8 -2 6 -2 8 -11 8 -2 5 1 10 6 19 -3 9 -12 10 -8 -1 -5 -5 -8 2 -10 -4 -5 -6 -10 -1 -5 3 1 7 9 15 0 6 -7 6 -2 3 -3 9 -6 -4 -6 7 -12 5 -2 6 1 14 -6 8 7 11 9 6 7 12 0 9 -7 19 3 13 Z"
id="Hokkaido"
title="北海道"/>
<path
class="land"
d="M 880 546 l 0 -6 -4 -2 2 -8 6 -6 14 -4 3 -16 3 -3 0 -4 -3 -2 2 -13 9 3 6 -1 6 26 6 4 8 -5 0 -9 9 5 5 5 5 -3 -1 -9 5 -6 -1 -9 -6 -5 -7 6 -9 1 -8 4 0 -11 2 -10 6 -9 8 0 12 11 12 -2 -3 21 3 6 0 22 6 17 9 4 1 3 -5 2 -1 3 -16 4 -18 10 -4 -3 0 -13 -12 -2 -8 5 -18 -5 -6 3 -12 -1 Z"
id="Aomori"
title="青森県"/>
<path
class="land"
d="M 936 662 l 23 10 3 5 9 -3 3 1 8 -16 4 -1 4 2 7 2 0 -5 5 -1 1 -5 2 -3 -1 -5 5 -3 -3 -2 3 -4 -2 -3 0 -5 6 -4 -3 -2 3 -9 0 -4 -3 -2 0 -9 -2 -6 -1 -6 0 -4 -2 -4 -1 -3 -5 -2 1 -6 -3 -3 0 -8 -11 -14 -4 3 -3 3 -17 4 -17 9 -3 -3 -6 4 0 8 -2 3 2 9 1 10 -3 9 0 9 -4 12 -6 4 2 9 8 9 0 4 -2 3 2 5 Z"
id="Iwate"
title="岩手県"/>
<path
class="land"
d="M 908 744 l 12 2 2 3 11 1 4 8 9 -7 4 0 -1 -15 7 -12 0 -10 11 -3 2 -4 6 0 9 10 2 -2 0 -9 -4 0 3 -8 -3 -2 1 -5 -1 -9 4 -2 1 -6 1 -6 4 2 -2 -10 -7 -3 -9 18 -3 -2 -10 4 -3 -5 -23 -10 -4 1 -1 3 -8 4 0 3 5 9 -1 8 -4 -1 -2 4 0 3 3 2 0 6 1 5 -4 6 -2 7 0 6 -4 2 -1 5 -6 3 Z"
id="Miyagi"
title="宮城県"/>
<path
class="land"
d="M 880 546 l 14 -2 5 0 5 -2 18 4 7 -5 13 3 0 12 -6 4 0 8 -2 3 2 8 1 12 -3 7 0 10 -4 12 -6 4 2 9 8 9 1 4 -3 3 2 6 1 7 -5 1 -1 3 -7 4 -9 -8 -14 -4 -13 -7 -6 0 9 -20 1 -24 -4 -7 0 -8 -15 0 -3 -3 -1 -7 4 0 4 3 5 -4 0 -4 5 -7 0 -9 2 -5 Z"
id="Akita"
title="秋田県"/>
<path
class="land"
d="M 879 650 l 7 1 13 7 14 4 8 7 1 4 5 8 -2 9 -3 -1 -2 4 0 3 3 2 1 11 -7 12 1 7 -4 2 -2 5 -6 3 0 4 2 3 -4 3 2 11 -4 2 -29 -5 -7 -5 5 -15 -3 -2 4 -7 4 0 5 -5 0 -4 -7 -6 -4 0 -1 -9 -7 -6 10 -13 8 -26 Z"
id="Yamagata"
title="山形県"/>
<path
class="land"
d="M 874 756 l 28 5 4 -2 -2 -11 4 -4 12 2 2 3 11 1 4 8 9 -7 4 0 6 15 0 14 1 16 2 7 -2 4 -2 4 0 11 -10 12 -11 -3 -3 -3 -10 9 -7 -6 -4 0 -4 -11 -9 -7 -5 -1 -10 0 -17 10 -4 3 -10 5 -4 0 -3 -2 2 -3 0 -8 -5 -9 -2 -4 1 -3 1 -4 -2 -3 1 -5 17 -7 6 -3 -2 -3 0 -4 5 -2 3 -8 Z"
id="Fukushima"
title="福島県"/>
<path
class="land"
d="M 888 908 l 4 4 12 1 2 4 11 0 6 -5 9 0 4 2 8 8 5 0 -15 -26 -1 -4 -3 -3 1 -11 4 -4 0 -3 -2 -4 3 -6 6 -18 3 -9 -12 -3 -2 -3 -10 9 -7 -6 -4 0 -2 4 0 12 -1 3 2 13 -6 9 -3 0 -19 10 -4 0 -10 1 3 3 3 2 1 9 10 5 Z"
id="Ibaraki"
title="茨城県"/>
<path
class="land"
d="M 846 829 l 5 0 11 -4 4 -4 16 -10 10 1 5 1 9 7 4 10 -2 5 1 12 -1 16 -6 8 -3 1 -19 10 -13 0 -9 -1 -4 -9 0 -7 3 -10 -7 0 1 -4 0 -3 -2 -11 Z"
id="Tochigi"
title="栃木県"/>
</g>
map.setOnProvinceClickLisener(new ChinaMapView.onProvinceClickLisener() {
@OverRide
public void onSelectProvince(String provinceName) {
Log.i(TAG, "onSelectProvince: -------->>>>>>>>>>>>>>>>>>:");
for (ProvinceModel provinceModel : provincesList) {
String name = provinceModel.getName();
if (name.equals(provinceName)) {
provinceModel.setColor(yellow);
}else {
provinceModel.setColor(grey);
}
Log.i(TAG, "onSelectProvince: " + name + ",, thread:" + Thread.currentThread().getName());
}
mapView.notifyDataChanged();
}
});
你好,
这段代码能实现点击的省份切换成我想要的颜色 但是log日志不停的打印 这是为啥 @NoEndToLF
请问能否在地图里显示省份名称?
能否在地图中加上南海诸岛的图例,这样感觉就不会有什么争议了
可以加入这么一个功能,用户自定义**地图,然后,有个功能是保存到本地,或者分享出去。
通过setBackgroundResource 或者 setBackgroundColor 虽然可以修改背景色,但好像是在白色底色上修改,如何让背景透明?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.