android: set WebView to (real) full screen

15,612

If you want to hide status bar and title bar use below code

in java file

requestWindowFeature(Window.FEATURE_NO_TITLE); 
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 

in manifest file

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

or if you want to resize the webview according to your actions use below code in your action listener

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
    webview.setLayoutParams(params);

try the above, it may help you.

Share:
15,612
yonilx
Author by

yonilx

Updated on June 29, 2022

Comments

  • yonilx
    yonilx almost 2 years

    I'm trying to make my WebView fullscreen by standard, i know how to stretch it to "full screen" but what I'm trying to do is to create the full screen you get when you long click the WebView and choose the full screen option. does anyone knows how to do that ?

    edit: What I mean is how to enter "Full Screen Mode" which is in option in WebView when you long click it.