I have a two Views. One is a WebView and the other is an ImageView. I set the auto zoom controls for the WebView like so:
webview.getSettings().setBuiltInZoomControls(true);
I am just changing the visibility of both Views using GONE
and Visible
. While changing my View from WebView to ImageView, the zoom controls do not lose their visibility for some period of time.
Is there any possible way to hide and show the Autozoomcontrols?
Edit:
I tried these methods, but it's still not working.
webview.getZoomControls().setVisibility(View.GONE);
webview.getZoomControls().invalidate();
getSettings(). setBuiltInZoomControls(false); use the above line of code to remove the zoom buttons.
hide(): This method is used to hide the ZoomControls from the screen.
public void setZoomControlGone(View view){
Class<?> classType;
Field field;
try {
classType = WebView.class;
field = classType.getDeclaredField("mZoomButtonsController");
field.setAccessible(true);
ZoomButtonsController mZoomButtonsController = new ZoomButtonsController(view);
mZoomButtonsController.getZoomControls().setVisibility(View.GONE);
try {
field.set(view, mZoomButtonsController);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With