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

2
  • You can set webView.setVisibility(View.GONE); and toggle it on button click.. Nov 29, 2013 at 9:42
  • 1
    you developed the whole thing and you have problem change the visibility of a View?
    – Blackbelt
    Nov 29, 2013 at 9:43

5 Answers 5

25

for hide the webview

mWebView.setVisibility(View.GONE);

for show the webview

mWebView.setVisibility(View.VISIBLE); 
1
  • okay thanks, my fault is using VIEW.INVISIBLE, now is working
    – Agoeng Liu
    Nov 29, 2013 at 9:45
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

1
  • okay thanks, my fault is using VIEW.INVISIBLE, now is working
    – Agoeng Liu
    Nov 29, 2013 at 9:58
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

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

1
  • okay thanks, my fault is using VIEW.INVISIBLE, now is working – Agoeng Lauw
    – Agoeng Liu
    Nov 29, 2013 at 9:53
0

If using XML, as easy as:

android:visibility="invisible"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.