I'm developing an application in PhoneGap for the Android platform.
In this app the scroll bar is not displayed. How can I display a scroll bar in my application?
I'm developing an application in PhoneGap for the Android platform.
In this app the scroll bar is not displayed. How can I display a scroll bar in my application?
Here is my example Activity that will display the scrollbars
public class MyActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
// Display vertical scrollbar and hide horizontal scrollBar
super.appView.setVerticalScrollBarEnabled(true);
super.appView.setHorizontalScrollBarEnabled(false);
// set scrollbar style
super.appView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
}
}
well scrolling is the effect that cannot be seen in phonegap/cordova projects, for that purpose we can there are tools third party libraries that you can include in your project. the one that i used for my project was iscroll 4 . even this has some problems but that can be solved surfing the google groups of iscroll4 also ther is this jquery-mobile that also gives scrolling effect for phonegap projects.
This solution does not completely solve the problem if you want to use scrolled div inside the main div.
Put others elements in absolute position over the main div.
Try this: Apache cordova on android where are scrollbars?
We have been facing the same issue. Cordova disables scroll bars on the web view in CordovaWebView.java
, so we created a plugin that allows you to reenable the vertical scrollbar programmatically from JavaScript without hacking up Cordova:
mayflower.AndroidScrollbar.toggleVerticalScrollbarVisibility(true)
.then(
function() {
console.log('Vertical scrollbar enabled');
}
);
I am using Cordova 5.2+ and facing the same challenge. But, I found the solution here:
You can go to: SystemWebViewEngine.java which located in yourAppName\platforms\android\CordovaLib\src\org\apache\cordova\SystemWebViewEngine.java
Then, set:
webView.setVerticalScrollBarEnabled(true);
Hope it helps Pal!