在Android上哪里滚动条的Apache科尔多瓦? [英] Apache cordova on android where are scrollbars?

查看:259
本文介绍了在Android上哪里滚动条的Apache科尔多瓦?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试建立与科尔多瓦一个简单的应用程序,它针对的android

我只是想有一个滚动的DIV,但

  • 如果含量低于div的高度较小,滚动条始终可见
  • 如果含量大于div的高度,滚动条不会出现,即使我滚动:滚动是可能的,但没有滚动条位置指示

我的布局很简单:

 <身体GT;
    < D​​IV ID ='意见'>
        < D​​IV CLASS ='查看'>
            Lorem存有...
        < / DIV>
    < / DIV>
< /身体GT;
 

CSS是过于简单:

  #views {
    位置:绝对的;
    顶部:0;右:0;底部:0;左:0;
}

。视图 {
    位置:绝对的;
    顶部:0;右:0;底部:0;左:0;
    溢出 -  X:隐藏;
    溢出-Y:滚动;
    -webkit-溢出滚动:触摸;
    溢出滚动:触摸;
}
 

然后我用命令:科尔多瓦运行Android

请注意:

  • 在我使用的科尔多瓦版本3.3.1-0.3.1
  • 在测试在Nexus 7更新(Android的奇巧)
  • 与去年Android的API:19

感谢您的帮助

编辑:我只是尝试与iOS模拟器(的iOS 6.1),滚动条都可见位置,当我滚动...

[更新] 感谢帮助我。 下面是是正确的code会对Android的滚动条

[更新2] 这不是完全没关系,试试这个,整个窗口滚动,不仅.view含量

HTML

 <身体GT;
    < D​​IV ID ='意见'>
        < D​​IV CLASS ='查看'>
            Lorem存有...
        < / DIV>
    < / DIV>
    < D​​IV ID ='菜单-BT>< / DIV>
< /身体GT;
 

CSS

  .view {
    位置:绝对的;
    顶部:0;右:0;底部:0;左:0;
    溢出:可见;
    -webkit-溢出滚动:触摸;
    溢出滚动:触摸;
}

#菜单-BT {
    位置:绝对的;
    右:40PX;底部:40PX;
    宽度:50像素;高度:50像素;
    背景颜色:绿色;
}
 

然后,在文件/plateforms/android/src/io/cordova/myProject/MyProject.java加入这一行

  super.appView.setVerticalScrollBarEnabled(真正的);
 

解决方案

在这里测试,改变你的溢出到可见它的工作原理。

此外,请务必使在你的Andr​​oid活动文件中的滚动条(尖的<一个href="http://stackoverflow.com/questions/10684066/how-to-add-scroll-bar-in-a-phonegap-application">here)通过添加以下行:

  super.appView.setVerticalScrollBarEnabled(真正的);
 

I try to build a simple app with cordova which target android

I just want to have a scrollable div but

  • if the content is smaller than the div's height, the scrollbar is always visible
  • if the content is bigger than the div's height, the scrollbar never appear, even if I scroll : the scroll is possible but no scrollbar position indication

My layout is simple :

<body>
    <div id='views'>
        <div class='view'>
            Lorem ipsum ...
        </div>
    </div>
</body>

Css is simple too :

#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 command : cordova run android

note :

  • I use cordova version 3.3.1-0.3.1
  • test on Nexus 7 updated (android kitkat)
  • with last android API : 19

Thanks for your help

edit : I just try with iOs simulator (iOS 6.1), the scrollbars are visibles when I scroll ...

[updated] Thanks to help me. Here is is the correct code to have scrollbars on android

[updated 2] It's not totally ok, try this, the whole window scroll, not only the .view content

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;
}

Then, add this line in file /plateforms/android/src/io/cordova/myProject/MyProject.java

super.appView.setVerticalScrollBarEnabled(true);

解决方案

Tested here and changing your overflows to visible it works.

Also, make sure to enable the scrollbars in your Android Activity file (as pointed here) by adding the following line:

super.appView.setVerticalScrollBarEnabled(true);

这篇关于在Android上哪里滚动条的Apache科尔多瓦?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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