Phonegap 3.0 - Android:原生滚动条不可见 [英] Phonegap 3.0 - Android: Native Scrollbar Not Visible

查看:39
本文介绍了Phonegap 3.0 - Android:原生滚动条不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在将一个非常大的 PhoneGap 应用程序上的滚动行为从第三方 JavaScript 滚动库转换为原生滚动.一切都很顺利,除了 Android 版本的原生滚动从不显示滚动条.

I am currently converting the scroll behavior on a very large PhoneGap application from a third party JavaScript scrolling library to native scroll. Everything has gone smoothly, except that the native scroll on the Android version never displays a scrollbar.

滚动行为正常工作,但没有显示滚动条来向用户提供有关屏幕上滚动位置的反馈.

The scroll behavior works correctly, but no scrollbar is displayed to give the user feedback about the scroll position on a screen.

我怀疑这是某种配置或 CSS 问题,但我尝试修改 CSS 和其他 Android 配置文件,例如清单和活动文件,但无济于事.

I suspect that this is some sort of configuration or CSS problem, but I have tried modifying CSS and other Android configuration files such as the manifest and activity files to no avail.

如何在 PhoneGap Android 上使用本机滚动启用可见滚动条?

How do I enable a visible scrollbar using native scroll on PhoneGap Android?

注意:我对第三方滚动解决方案(例如 iScroll)感兴趣.iScroll 的转换已经完成了 90%,除了 Android 上的可见滚动条问题.

Note: I am not interested in a third party scrolling solution (such as iScroll). The conversion from iScroll is already 90% done with the exception of the visible scrollbar problem on Android.

推荐答案

我能够通过使用仅适用于 Android 的 Webkit 滚动条 CSS 自己完成此任务.我使用

I was able to accomplish this myself by using Webkit scrollbar CSS that only gets applied on Android. I add the android-scroll-bar class to the page on Android by using

$('html').addClass('android-scroll-bar');

这是必要的 CSS:

.android-scroll-bar ::-webkit-scrollbar {width: 5px;}

.android-scroll-bar ::-webkit-scrollbar-track { border-radius: 10px;}

.android-scroll-bar ::-webkit-scrollbar-thumb { border-radius: 10px; background: rgb(169,169,169); }

.android-scroll-bar ::-webkit-scrollbar-thumb:window-inactive {background: rgb(128,128,128); }

这篇关于Phonegap 3.0 - Android:原生滚动条不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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