选择文本字段时防止缩放
当选择文本框进行输入时,是否可以强制 android 不放大?我编写了一个 html5 Web 应用程序,在单击文本字段输入文本之前,布局看起来很棒。执行此操作后,Android 将自动放大文本字段。有办法防止这种情况吗?谢谢!
我的 webview 代码如下:
WebView myWebView = (WebView) findViewById(R.id.webview);
WebViewClient wv = new WebViewClient();
wv.shouldOverrideUrlLoading(myWebView, "http://urlgoeshere");
myWebView.setInitialScale(1);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setBuiltInZoomControls(false);
myWebView.getSettings().setLoadsImagesAutomatically(true);
myWebView.getSettings().setUseWideViewPort(true);
myWebView.getSettings().setDefaultZoom(ZoomDensity.FAR);
myWebView.getSettings().setSupportZoom(false);
myWebView.getSettings().setDomStorageEnabled(true);
myWebView.setWebViewClient(wv);
myWebView.loadUrl("http://urlgoeshere");
我的 webview xml 如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
Is it possible to force android not to zoom in when a text box is selected for typing? I have written an html5 web app and the layouts look great until I click on the textfield to enter text. Upon this action, android will automatically zoom in on the textfield. Is there a way to prevent this? Thanks!
My code for the webview is as follows:
WebView myWebView = (WebView) findViewById(R.id.webview);
WebViewClient wv = new WebViewClient();
wv.shouldOverrideUrlLoading(myWebView, "http://urlgoeshere");
myWebView.setInitialScale(1);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setBuiltInZoomControls(false);
myWebView.getSettings().setLoadsImagesAutomatically(true);
myWebView.getSettings().setUseWideViewPort(true);
myWebView.getSettings().setDefaultZoom(ZoomDensity.FAR);
myWebView.getSettings().setSupportZoom(false);
myWebView.getSettings().setDomStorageEnabled(true);
myWebView.setWebViewClient(wv);
myWebView.loadUrl("http://urlgoeshere");
My xml for the webview is as follows:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果不需要,请尝试删除
setDefaultZoom()
。这样您的程序就会将其留给手机来适应页面,并且不会强制放大Try removing the
setDefaultZoom()
if that's not necessary. That way your program leaves it to the phone to accommodate the page and won't force zoom-in