7

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 enter image description here

Agoeng Liu
  • 674
  • 3
  • 10
  • 30

5 Answers5

25

for hide the webview

mWebView.setVisibility(View.GONE);

for show the webview

mWebView.setVisibility(View.VISIBLE); 
King of Masses
  • 18,405
  • 4
  • 60
  • 77
Hardik
  • 17,179
  • 2
  • 35
  • 40
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

Hardik
  • 17,179
  • 2
  • 35
  • 40
LuminiousAndroid
  • 1,557
  • 4
  • 18
  • 28
1

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

vk_only
  • 39
  • 4
0

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

d3m0li5h3r
  • 1,957
  • 17
  • 33
0

If using XML, as easy as:

android:visibility="invisible"