gpt4 book ai didi

android-webview 不左右移动/平移/滚动

转载 作者:行者123 更新时间:2023-11-29 17:46:01 33 4
gpt4 key购买 nike

我有一个 webview,我想加载一个网站,当我加载它时,它不会左右移动。它只是上升/下降。 (平移/滚动 Action )

这是代码:

WebView wb=(WebView)findViewById(R.id.webView1);
WebSettings settings = wb.getSettings();
settings.setDefaultTextEncodingName("utf-8");
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
settings.setSaveFormData(false);
settings.setSupportZoom(true);

谢谢。

最佳答案

您可以通过以下方式实现:

settings.setUseWideViewPort(true);

但是您应该在 Android SDK 文档中阅读更多相关信息:

public synchronized void setUseWideViewPort (boolean use)

Added in API level 1 Sets whether the WebView should enable supportfor the "viewport" HTML meta tag or should use a wide viewport.

Whenthe value of the setting is false, the layout width is always set tothe width of the WebView control in device-independent (CSS) pixels.

When the value is true and the page contains the viewport meta tag,the value of the width specified in the tag is used. If the page doesnot contain the tag or does not provide a width, then a wide viewportwill be used.

Parameters

use whether to enable support for the viewport meta tag

更多信息@ http://developer.android.com/reference/android/webkit/WebSettings.html#setUseWideViewPort(boolean)

关于android-webview 不左右移动/平移/滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26699792/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com