将 HTML 加载到 Web View 后,我会在布局的右侧和底部看到一条白色条纹。对于正确的一个,我使用以下方法解决了它:
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);
关于java - 填充Webview内容时的Android底部白色条纹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9708220/