Android 如何在webview中显示网页配件?
在我的应用程序中,它有一个Web视图和链接按钮。Android 如何在webview中显示网页配件?,android,Android,在我的应用程序中,它有一个Web视图和链接按钮。 如果单击该按钮,webview将加载目标页面 有些页面适合webview,看起来不错,但有些页面不适合。 在每个加载的页面中,他们都有这个 <meta name="viewport" content="width=device-width, initial-scale=0.8"> 更新 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andro
如果单击该按钮,webview将加载目标页面 有些页面适合webview,看起来不错,但有些页面不适合。
在每个加载的页面中,他们都有这个
<meta name="viewport" content="width=device-width, initial-scale=0.8">
更新
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
尝试将其用于您的网络视图
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
要在Webview中安装网页,请参见@Sameer我尝试过,但它返回了此错误图片宽度无法解析为变量
您可以为Webview发布xml吗?@Shrikant确定。我不知道如何定义PIC_WIDTH@Shrikant我在问题中添加了更新。感谢您尝试此webview..getSettings().setDefaultZoom(ZoomDensity.FAR);我需要在onCreate中只写一次吗?或者也在loadThisUrl(字符串url)中?这是您的webview的设置,因此在这一行myWebView.getSettings()之后只写一次。setUseWideViewPort(true);我也面临着同样的问题,但我的应用程序没有考虑到这一部分,所以如果对此感到好奇,请尝试WebView.setInitialScale(1);或检查此链接
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />