具有可调整大小功能的垂直分屏在浏览器中有效,但在Webview中不可用

时间:2018-12-21 13:24:59

标签: javascript android jquery android-webview

这是我的html代码

    <html>
  <head>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
        <style>
            #div1, #div2 {
  position: absolute;
  left: 0;
  right: 0;
  outline: solid 1px #ccc; /* just for making the divs visible */
  margin: 5px; /* just for making the divs visible */
}
#div1 {
  height: 100px;
  top: 0;
  background-color: white;
  overflow-y: scroll;
}
#div2 {
  top: 110px;
  bottom: 0;
  background-color: white;
  overflow-y: scroll;
}
        </style>


  </head>
  <body>
    <div id="div1">
        <div>
        some Long content here,some Long content here,some Long content here,some Long content here,some Long content here,some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content heresome Long content here
        some Long content heresome Long content here



        </div>
            <div>
        some Long content here,some Long content here,some Long content here,some Long content here,some Long content here,some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content heresome Long content here
        some Long content heresome Long content here    
        </div>
        <div>
        some Long content here,some Long content here,some Long content here,some Long content here,some Long content here,some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content here
        some Long content heresome Long content here
        some Long content heresome Long content here  
        </div>
    </div> 

    <div id="div2"><div>
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom


        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom

        some Long content here  Bottom

        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom

        some Long content here  Bottom

        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        </div>
            <div>
         some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom


        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom

        some Long content here  Bottom

        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom

        some Long content here  Bottom

        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        </div>
        <div>
         some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom


        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom

        some Long content here  Bottom

        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom
some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottomsome Long content here  Bottom

        some Long content here  Bottom

        some Long content here  Bottom
        some Long content here  Bottomsome Long content here  Bottom
        some Long content here  Bottom
        some Long content here  Bottom 
        </div>
    </div>


    <script type="text/javascript">
        $('#div1').resizable({
  handles: 's',
  resize: resizeEventHandler
});
function resizeEventHandler(event, ui){
  var new_height = ui.size.height;
  $('#div2').css('top', new_height + 10);
}
        </script>
  </body>
</html>

这将创建一个完美的垂直拆分视图

,它的大小也可以调整

但是当我使用android webview加载相同功能时,可调整大小的功能就会丢失

这是我在Android代码中所做的

setContentView(R.layout.activity_webview_test);
    String webPageUrl = "http://192.168.1.72/Testing/xHtml/verticalSplitter.html";
    webView = (WebView)findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new myWebClient());
    webView.getSettings().setLoadsImagesAutomatically(true);
    webView.getSettings().setAllowFileAccessFromFileURLs(true);
    webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
    webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    webView.loadUrl(webPageUrl);

我不知道这有什么问题,我尝试了很多,但没有用。

然后我尝试在网络本身中的一个页面进行检查,以检查是否尝试使用webview加载该页面并进行了测试

http://layout.jquery-dev.com/demos/simple.html

但是这也不起作用。

在Webview中还有什么我需要使用的吗?

请帮助谢谢:)

0 个答案:

没有答案