cprcrack / VideoEnabledWebView

Android's WebView and WebChromeClient class extensions that enable fully working HTML5 video support
MIT License
1.05k stars 289 forks source link

After closing fullscreen view, webview auto scrolls to the top #53

Open SiarheiSm opened 4 years ago

SiarheiSm commented 4 years ago

If video iframe belove some other content (text and ect) after closing fullscreen webview auto scrolls to the top of the page. There is no issue if not apply FLAG_FULLSCREEN. is there is a way to make it working with FLAG_FULLSCREEN?

SiarheiSm commented 4 years ago

for me the issue was that webview have match_perent or wrap_content in height and after applying FLAG_FULLSCREEN webview lose it height. solution was to set layoutParams.height = height before FLAG_FULLSCREEN

TestereNecmi commented 4 years ago

Can you share source code ?

erengms commented 2 years ago

other solutions,

//when going fullscreen
int positionY = webView.getScrollY();

//when exiting fullscreen
 webView.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            webView.scrollTo(0, positionY);
                        }
                        // Delay the scrollTo to make it work
                    }, 800);