将 HTML 加载到 Web 视图后,我会在布局的右侧和底部看到一条白色条纹。对于正确的,我使用以下方法解决了它:
setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
然而,我尝试了很多方法来删除底部的一个,但没有成功。即使在我阅读了所有相关帖子之后。如果需要更多代码,请告诉我。
xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView android:autoLink="web"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webview1"
android:textColor="@android:color/black"
></WebView>
</LinearLayout>
activity
browse = (WebView) findViewById(R.id.webview1);
browse.getSettings().setJavaScriptEnabled(true);
browse.getSettings().setUseWideViewPort(true);
browse.getSettings().setLoadWithOverviewMode(true);
browse.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
browse.setScrollbarFadingEnabled(false);
在您的 WebView xml 中,添加 android:scrollbars="none"
<WebView android:autoLink="web"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webview1"
android:textColor="@android:color/black"
android:scrollbars="none"
></WebView>
并删除setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)