一些矢量图在android中无法进行展示,这时我们需要通过哦其他的提劲进行处理。
如在资源文件中放入html,使用html对矢量图进行包装,,在应用页面使用webview进行引入。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<style type="text/css">
body { font-family: "Verdana", "Arial", "Helvetica", "sans-serif"; font-size: 12px; line-height: 180%; }
</style>
<SCRIPT language=JavaScript>
drag = 0
move = 0
var ie=document.all;
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var y,x;
var oDragObj;
function moveMouse(e) {
if (isdrag) {
oDragObj.style.top = (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y)+"px";
oDragObj.style.left = (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x)+"px";
return false;
}
}
function initDrag(e) {
var oDragHandle = nn6 ? e.target : event.srcElement;
var topElement = "HTML";
while (oDragHandle.tagName != topElement && oDragHandle.className != "dragAble") {
oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement;
}
if (oDragHandle.className=="dragAble") {
isdrag = true;
oDragObj = oDragHandle;
nTY = parseInt(oDragObj.style.top+0);
y = nn6 ? e.clientY : event.clientY;
nTX = parseInt(oDragObj.style.left+0);
x = nn6 ? e.clientX : event.clientX;
document.onmousemove=moveMouse;
return false;
}
}
document.onmousedown=initDrag;
document.onmouseup=new Function("isdrag=false");
</SCRIPT>
<script language="JavaScript" type="text/JavaScript">
var count = 10;
function Picture()
{
count = Counting(count);
Resize(count);
return false;
}
function Counting(count){
if (event.wheelDelta >= 120) {
if(count<21){count++;}
}
else if(event.wheelDelta <= -120) {
if(count>4){count--;}
}
return count;
}
function Resize(count){
oImage.style.zoom = count + '0%';
}
</script>
</head>
<body style="overflow-y:hidden;overflow-x:hidden;">
<div id='block1' onmouseout='drag=0' onmouseover='dragObj=block1; drag=1;' style='z-index:10; height: 0; width: 0; position: absolute; top: 0px;left: 0px; ' class="dragAble">
<img id="oImage" name='images1' src='roadgrid.svg' border='0' style="cursor:crosshair;" onmousewheel="Picture()">
</div>
</body>
</html>
android代码如下:
area_road_network_web_view.loadUrl("file:///android_asset/www/luwang.html");