How to hide unhide webview in android

2019-02-10 09:07发布

问题:

I develop application which has webview and imageview(as toogle button), if button clicked then webview will be closed, if button clicked again, then webview will be opened. Is it possible in android? see the circle red with up arrow which can hide and unhide above banner My reference like this application

回答1:

for hide the webview

mWebView.setVisibility(View.GONE);

for show the webview

mWebView.setVisibility(View.VISIBLE); 


回答2:

Just take all of your view which you want to hide in one Linearlayout having orientation set to vertical and visiblity to visible and gone as below.

webView.setVisiblity(View.GONE); 

and

webView.setVisiblity(View.Visible);

where webview is initialized by you xml's Webview.

I hope this works for you.

Thanks



回答3:

you use setvisibility() method are follow...

  1. if hide webview

    webview.setvisibility(view.GONE);

  2. if visible webview then

    webview.setvisibility(view.visible);

    that's solve your problem



回答4:

You can use setVisibility() method to achieve that.. setVisibility(View.VISIBLE) to make the webview visible else setVisibility(View.INVISIBLE) or setVisibility(View.GONE) to make it vanish