Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
257 views
in Technique[技术] by (71.8m points)

javascript - Phonegap 3.0 - Android: Native Scrollbar Not Visible

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.

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.

How do I enable a visible scrollbar using native scroll on PhoneGap 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

Here is the necessary 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); }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...