I want to determine the width and the height of the WebView
. I have already tried it using:
webView.getWidth();
webView.getHeight();
Hmmm - I looked through the WevView source and I can see that internally they are using View#getWidth and View#getHeight here's one of the WebView
's private methods:
/*
* Return the width of the view where the content of WebView should render
* to.
*/
private int getViewWidth() {
if (!isVerticalScrollBarEnabled() || mOverlayVerticalScrollbar) {
return getWidth();
} else {
return getWidth() - getVerticalScrollbarWidth();
}
}
As noted in the comments you have to make sure you are measuring it after you assign the activity layout e.g. setContentView(R.layout.mylayout);