I want to determine the width and the height of the WebView
. I have already tried it using:
webView.getWidth();
webView.getHeight();
but the resulting log always shows them to be 0.
You were probably checking for the sizes too soon, most likely in the onCreate
. Instead, try this:
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView webView, String url) {
super.onPageFinished(webView, url);
Log.i(TAG, findViewById(R.id.my_component).getWidth(););
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With