Как получить ширину и высоту Webview в андроиде

Да, Вы делаете. Вы определяете автономную работу, которая NSOperationQueue выполнит на "немного" поток, таким образом, Вы будете ответственны за руководящую память в той части работы.

8
задан jAC 21 September 2016 в 12:56
поделиться

1 ответ

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);

1
ответ дан 5 December 2019 в 17:38
поделиться
Другие вопросы по тегам:

Похожие вопросы: