我正在使用EaselJS将一些图形矩形渲染到easelJS中的形状和Android中的WebView中。但是当绘制图形的Shape移动时,旧绘制的矩形保持原样,就好像打印固定在屏幕上一样。但是,在我桌面上的Chrome上,使用相同的HTML5一切正常。我尝试了stage.clear()
,webView.clearcache
,但似乎都没有。知道可能是什么问题吗?
以下的Android代码
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setDefaultZoom(ZoomDensity.FAR);
webSettings.setDefaultFontSize(24);
webSettings.setBuiltInZoomControls(true);
//webSettingssetBackgroundColor(0);
//webSettings.setHorizontalScrollBarEnabled(true);
//webSettings.setVerticalScrollBarEnabled(true);
webSettings.setSupportZoom(true);
webSettings.setRenderPriority(RenderPriority.HIGH);
myWebView.clearCache(true);
myWebView.clearView();
myWebView.setWebChromeClient(new WebChromeClient());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
下面的HTML5代码:
var shape1 = new createjs.Shape();
shape1.color = baseColors[Math.floor(Math.random() * (baseColors.length))];
shape1.graphics.beginFill(shape1.color).drawRect(0, 0, 30,30);
stage.addChild(shape1);
stage.update();