I am trying to create a simple application with a corridor whose goal is Android.
I just want to have a scrollable div, but
- If the content is less than the height of the div, the scroll bar is always visible
- If the content is greater than the height of the div, the scroll bar never appears even if I scroll: scroll is possible, but an indication of the position of the scroll bar
My layout is simple:
<body>
<div id='views'>
<div class='view'>
Lorem ipsum ...
</div>
</div>
</body>
Css is also simple:
#views {
position : absolute;
top:0; right:0; bottom:0; left:0;
}
.view {
position : absolute;
top:0; right:0; bottom:0; left:0;
overflow-x : hidden;
overflow-y : scroll;
-webkit-overflow-scrolling : touch;
overflow-scrolling : touch;
}
Then I use the command: rootova run android
Note:
- I am using cordova version 3.3.1-0.3.1
- Nexus 7 test updated (android kitkat)
- with the latest Android API: 19
thanks for the help
edit: I'm just trying to use an iOS simulator (iOS 6.1), the scroll bars are visible when I scroll ...
[updated] Thank you for helping me. Here is the correct code to have scrollbars on android
[ 2]
, , , .view
HTML
<body>
<div id='views'>
<div class='view'>
Lorem ipsum ...
</div>
</div>
<div id='menu-bt'></div>
</body>
CSS
.view {
position:absolute;
top:0; right:0; bottom:0; left:0;
overflow:visible;
-webkit-overflow-scrolling:touch;
overflow-scrolling:touch;
}
#menu-bt {
position:absolute;
right:40px; bottom:40px;
width:50px; height:50px;
background-color:green;
}
/plateforms/android/src/io/cordova/myProject/MyProject.java
super.appView.setVerticalScrollBarEnabled(true);