滚动时模糊的webview背景

时间:2015-05-08 21:04:58

标签: android android-webview

我的问题是滚动时webview背景模糊。背景是一个图像。我的代码:

WebView webview = (WebView) findViewById(R.id.webview);
webview.setBackgroundColor(0x00000000);
webview.setBackgroundResource(R.drawable.regularbackground);

1 个答案:

答案 0 :(得分:1)

在您的代码中添加:

<!DOCTYPE HTML>
<html>
    <head>
        <title>UnSlider</title>
        <style>
            body, html {
                padding:0px;
                margin: 0px;
            }
            .banner { 
                position: relative; 
                width: 100% !important; 
                overflow: auto; 
                padding: 0px;
                margin: 0px;
            }
            .banner ul {
                padding: 0px;
                margin: 0px;
            }
            .banner li { 
                list-style: none; 
                padding: 0px;
                margin: 0px;
            }
            .banner ul li { 
                float:left;
                padding: 0px;
                margin: 0px;
                min-height: 350px;
                -webkit-background-size: 100% auto;
                -moz-background-size: 100% auto;
                -o-background-size: 100% auto;
                -ms-background-size: 100% auto;
                background-size: 100% auto;
                background-position-y: -75px;
                box-shadow: inset 0 -3px 6px rgba(0,0,0,.1);
            }
        </style>
    </head>
    <body>
        <div class="banner">
            <ul>
                <li style="background-image: url("../images/jam.jpg");"></li>
                <li style="background-image: url('http://placehold.it/1400x400');"></li>
                <li style="background-image: url('http://placehold.it/1400x400');"></li>
                <li style="background-image: url('http://placehold.it/1400x400');"></li>
            </ul>
        </div>

        <script src="http://code.jquery.com/jquery-latest.min.js"></script>
        <script src="http://unslider.com/unslider.min.js"></script>

        <script>
            $(document).ready(function(){
                $('.banner').unslider({
                    speed: 500,               //  The speed to animate each slide (in milliseconds)
                    delay: 5000,              //  The delay between slide animations (in milliseconds)
                    keys: true,               //  Enable keyboard (left, right) arrow shortcuts
                    dots: false,               //  Display dot navigation
                    fluid: false              //  Support responsive design. May break non-responsive designs
                });
            });
        </script>
    </body>
</html>