I'm extracting frames from a WebView in it's draw
method and scrolling it programmatically. The problem is, no matter how big my bitmap is, I only get the output from the WebView based on its initial dimensions. the getHeight()
returns a value of 1440 and that's all I can ever get from the WebView even if I make the bitmap larger and/or I scroll the WebView.
this is its draw
method:
@Override
public void draw( Canvas canvas ) {
int height = getHeight();
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
newCanvas = new Canvas(bitmap);
super.draw(newCanvas);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
array.Buffer = stream.toByteArray();
mPluginInterfaceBitmap.onFrameUpdate(array, width, height);
stream.reset();
}
I'm scrolling the webview like so:
mWebView.scrollBy(0,yScrollBy);
and I know it's scrolling because in subsequent frames I check:
mWebView.getScrollY()
My XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.export.ian.webviewtest android:id="@+id/web_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
I've also tried increasing the size of the webview to match its ContentHeight
but this never works and I'm not sure how it would work for infinte-scrolling websites. I want to be able to scroll the webview programmatically and extract the frame of whatever the user would see in the webpage.
This is what it looks like after scrolling a bit (ignore the angle of image)