Android phonegap从html创建位图

Android phonegap从html创建位图,android,cordova,bitmap,android-webview,Android,Cordova,Bitmap,Android Webview,如何从设备屏幕中的html创建位图 我尝试了这个,但它给了我一个黑色的图像输出 Webview mAppView = this.webView; float appScale = mAppView.getScale(); int scaledViewHeight = (int)(webViewHeight * appScale); int scaledViewWidth = (int)(webViewWidth * appScale); bmp = Bitmap.createBitmap(s

如何从设备屏幕中的html创建位图

我尝试了这个,但它给了我一个黑色的图像输出

Webview mAppView = this.webView;
float appScale = mAppView.getScale();

int scaledViewHeight = (int)(webViewHeight * appScale);
int scaledViewWidth = (int)(webViewWidth * appScale);

bmp = Bitmap.createBitmap(scaledViewWidth, scaledViewHeight, Bitmap.Config.RGB_565);

try {
    os = new FileOutputStream(Environment.getExternalStorageDirectory()+"/DCIM/Camera/" + "canvas.png");
    bmp.compress(CompressFormat.PNG, 90, os);

    } catch(IOException e) {
        Log.v("save image", "fail"); 
    }

您需要将url从图像传递到进行url到位图转换的方法,或者可能获取base64数据并从中创建位图,但不确定这在Android中是否有效。我的问题是,我无法使用Android本机将图像合并到图像,因为它们太大,并且会出现内存错误,因此,我创建了一个画布,在那里我组合了两个图像。我正试图使它与较低的android版本兼容,因为toDataURL对它们不起作用