2013-08-28 34 views
1

我通過使用html5和phonegap(cordova 2.7.0)開發了一個android應用程序;它是一個圖像搜索的應用程序,使用谷歌API。 返回以輕擊開頭的圖像列表。Android Phonegap滾動不起作用

它幾乎適用於所有設備,但在Android 2.3.x的小屏幕上,滾動(或點擊圖像)不起作用。

有什麼建議嗎?

在此先感謝。

+1

其實它不是一個小屏幕的問題。它與Droid 2.3中的webview有關。你不會注意到這一點的Droid 4.x版+ – GoodSp33d

回答

2

您已遇到android bug。 BODY標籤內的溢出DIV不允許您滾動。 iPhone中存在同樣的錯誤(iOS < 5),但至少可以使用兩根手指並滾動。

但是有一些解決方法。您可以使用第三方庫,如iScroll,touchScroll ...

iScroll將禁用已應用滾動到div的投入。如果它的一個簡單的段落使用iScroll。

Reference

+0

Thx的反饋,我會盡力 – user2726314

+0

好,謝謝,溢出的問題就迎刃而解了。 但仍有點擊圖像上的問題,在Android 2.3.x.不起作用 有什麼建議嗎? 感謝 – user2726314

+1

@ user2726314你使用何種滾動插件?如果其[這一個](http://chris-barr.com/2010/05/scrolling_a_overflowauto_element_on_a_touch_screen_device/),那麼你需要註釋掉'event.preventDefault()'在第一個監聽線路。 – GoodSp33d

0

雖然兩司爐的答案是正確的這裏是一個快速和骯髒的解決方案,在末尾添加一些<br>標籤。工作對我來說)

+0

增加了 dinamically($。()。append)並且沒有工作 – netalex

0

如果你不想去通過添加iScroll的你也可以使用的麻煩:

// Workaround for problematic scrolling behaviour on Android 
// we can't fix this in css directly as it breaks iOS and the 
// platform selector in css is unreliable 
if (device.platform === 'Android') { 
    $('.ui-mobile, .ui-mobile .ui-page, .ui-mobile [data-role="page"], .ui-mobile [data-role="dialog"], .ui-page, .ui-mobile .ui-page-active ').css("position", "initial"); 
}