简体   繁体   English

隐藏滚动条Android KitKat 4.4

[英]Hide scrollbar Android KitKat 4.4

My phonegap build app is working fine on all versions of android from 4.0.4 to 4.3. 我的phonegap构建应用程序在从4.0.4到4.3的所有android版本上都能正常工作。

When I tested it on KitKat 4.4 some pages where content doesn't cover the screen height has got scrollbars shown. 当我在KitKat 4.4上对其进行测试时,某些页面的内容无法覆盖屏幕高度,因此显示了滚动条。 On pages where content needs to be scrolled scrollbars hidden. 在需要滚动内容的页面上,滚动条处于隐藏状态。

I don't know what the problem is and how to solve it. 我不知道问题是什么以及如何解决。

Does anyone have an idea how to fix it? 有谁知道如何解决它? Or is there a css code (not overflow: ...; ) or jQuery script how to prevent it or make a virtual object with a couple of pixels more than the height of the screen. 还是有css代码(不overflow: ...; )或jQuery脚本如何防止它或使虚拟对象的像素比屏幕高度高几个像素。

![Screenshot][1] [1]: http://i.stack.imgur.com/bUaBS.png ![截图] [1] [1]: http : //i.stack.imgur.com/bUaBS.png

From here: https://developers.google.com/chrome/mobile/docs/webview/overview 从这里: https//developers.google.com/chrome/mobile/docs/webview/overview

Android 4.4 (KitKat) includes a new WebView component based on the Chromium open source project. Android 4.4(KitKat)包括一个基于Chromium开源项目的新WebView组件。

It means that Android 4.4 (KitKat) now uses Chrome for WebView-based apps. 这意味着Android 4.4(KitKat)现在将Chrome用于基于WebView的应用程序。 On Chrome, when using the css property "overflow: scroll", the browser displays the scrollbar (even if content is smaller than the parent view). 在Chrome上,当使用css属性“ overflow:scroll”时,浏览器将显示滚动条(即使内容小于父视图)。

Changing "overflow: scroll" to "overflow: auto" fixed the issue for me. 将“溢出:滚动”更改为“溢出:自动”对我来说已解决此问题。

You can use this: 您可以使用此:

SELECTOR::-webkit-scrollbar {
  display: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM