WebView 只在屏幕左半边显示网页内容的问题

遇到一个WebView加载HTML内容时出现的问题,网页内容仅在屏幕左侧显示。已检查相关代码,包括WebView设置、WebSettings参数配置以及XML布局文件。设置包括:使用宽视图模式,适应概述模式,调整文字缩放,并在ScrollView中嵌套了WebView。问题可能出在布局文件的宽度设置或滚动条配置上。
摘要由CSDN通过智能技术生成

问题如图所示。

Activity WebView 设置的代码

contentView = (WebView)this.findViewById(R.id.content);

WebSettings mWebSettings = contentView.getSettings();
mWebSettings.setUseWideViewPort(true); 
mWebSettings.setLoadWithOverviewMode(true); 
mWebSettings.setTextZoom(getResources().getInteger(R.integer.webview_text_size));
contentView.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
sourceView.setText(source);


xml 里面的代码

<LinearLayout 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_paren
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值