Android底部白色条纹填充Webview内容时 [英] Android Bottom White Stripe When Filling Webview Content

查看:120
本文介绍了Android底部白色条纹填充Webview内容时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦将HTML加载到Webview中,我将在布局的右侧和底部获得一个白色条纹。对于正确的一个,我使用以下方式解决了:



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>

活动

  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 =无

 < 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);


Once an HTML is loaded in to a webview, I get a white stripe on the right and bottom of the layout. For the right one I solved it using:

setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);

However, I have tried many options to remove the bottom one with no success. Even after I read all the related posts. If more code is required please let me know.

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);

解决方案

In your WebView xml, add 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>

And remove the setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);

这篇关于Android底部白色条纹填充Webview内容时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆