setDefaultZoom(WebSettings.ZoomDensity.valueOf(arg0)) 的 arg0 是什么?
我想使用以下功能将WebView缩放到任意百分比
setDefaultZoom(WebSettings.ZoomDensity.valueOf(arg0)
但我不知道如何正确设置arg0
的值。
我尝试使用setInitialScale()
来设置缩放百分比,但它不适用于某些网页。
I want to zoom the webview to any percentage with the function of
setDefaultZoom(WebSettings.ZoomDensity.valueOf(arg0)
But I do not know how to set the value of arg0
correctly.
I tried to use setInitialScale()
to set the zoom percentage, but it does not work for some web page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
WebSettings.ZoomDensity
只是一个enum
,其值为CLOSE
、FAR
和MEDIUM
。因此,要回答您的标题问题:arg0
是字符串"CLOSE"
、"FAR"
或"MEDIUM"< 之一/代码>。这将导致:
但可以更简单地表述为:
如果您使用静态导入语句,例如:
那么您可以简单而优雅地执行此操作:
WebSettings.ZoomDensity
is just anenum
with the valuesCLOSE
,FAR
, andMEDIUM
. So to answer your title question:arg0
is one of the strings"CLOSE"
,"FAR"
, or"MEDIUM"
. This would lead to:But that could be stated more simply as:
And if you used a static import statement such as:
Then you could simply and elegantly do this:
根据 文档,
ZoomDensity
是一个用于设置所需密度的枚举。所以你可以像这样设置它:
valueOf()
只是将字符串转换为枚举值的一种方法:According to the documentation,
ZoomDensity
is an enum for setting the desired density.So you can set it like so:
valueOf()
is just a way to convert a string into an enum value:WebSettings.ZoomDensity 是一个枚举,valueOf(String) 方法继承自 Enum。 setDefaultZoom(WebSettings.ZoomDensity) 方法的调用方式如下:
Here is the Documentation对于 ZoomDensity 枚举
WebSettings.ZoomDensity is an enumeration and the valueOf(String) method is inherited from Enum<E>. The setDefaultZoom(WebSettings.ZoomDensity) method should be called like:
Here is the documentation for the ZoomDensity enum