簡體   English   中英

Android Webview按鈕不起作用

[英]Android Webview buttons not working

我正在制作一個html應用程序,並在Webview中的Android上運行它。 一切都可以在我的三星s3 mini和我測試過的其他兩個設備上按預期進行,但是按一下按鈕對其他一些設備沒有任何影響(例如htc wildfire ...我正在尋找哪些設備不起作用)。

按鈕的css是:

button {
    -moz-box-shadow:inset 0px 1px 10px 0px #000000;
    -webkit-box-shadow:inset 0px 1px 10px 0px #000000;
    box-shadow:inset 0px 1px 10px 0px #000000;
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #00ff00), color-stop(1, #00ff00) );
    background:-moz-linear-gradient( center top, #00ff00 5%, #00ff00 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ff00');
    background-color:#00ff00;
    -webkit-border-top-left-radius:42px;
    -moz-border-radius-topleft:42px;
    border-top-left-radius:42px;
    -webkit-border-top-right-radius:42px;
    -moz-border-radius-topright:42px;
    border-top-right-radius:42px;
    -webkit-border-bottom-right-radius:42px;
    -moz-border-radius-bottomright:42px;
    border-bottom-right-radius:42px;
    -webkit-border-bottom-left-radius:42px;
    -moz-border-radius-bottomleft:42px;
    border-bottom-left-radius:42px;
    text-indent:0px;
    border:1px solid #006400;
    display:inline-block;
    color:#000000;
    font-family:Arial;
    font-size:1.2em;
    font-weight:bold;
    font-style:normal;
    line-height:46px;
    text-decoration:none;
    text-align:center;
    text-shadow:1px 1px 0px #00ff00;
    width:7em;
}

button:hover {
    background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #00ff00), color-stop(1, #00ff00) );
    background:-moz-linear-gradient( center top, #00ff00 5%, #00ff00 100% );
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00',         endColorstr='#00ff00');
    background-color:#00ff00;
}

button:active {
    position:relative;
    top:1px;
}

其中一個按鈕具有:

.button-wrap {
    width:auto;
}

有趣的是,帶有class="button-wrap"的按鈕是唯一可在一個設備上使用的按鈕。

按鈕的HTML很簡單:

<button class="button-list-spacing" id="play-game-button">Play!</button>

它們后面的js是:

$("#play-game-button").click(function (e) {
    window.location.replace("gamepage.html?soundon=" + SOUND_ON);
});

有誰知道任何可能導致按鈕不響應點擊的事情? 以后,我將使用它可以使用的設備列表以及它不能使用的列表進行編輯。

編輯:

這些按鈕在* Samsung Galaxy Tab 7.0 GT-P6200,Android 3.2上不起作用

這是一個小提琴: http : //jsfiddle.net/Yuy7F/

我在這里發布了一個相關的問題,可能值得一試: https : //stackoverflow.com/questions/22595810/android-webview-messes-up-in-4-1-1-but-not-4-1- 2

顯然,您正在使用jquery之類的框架。

確保該框架的所有javascript文件均可用,或嘗試執行以下操作:

<button class="button-list-spacing" id="play-game-button" onclick="window.location.replace("gamepage.html?soundon=" + SOUND_ON);">Play!</button>

並確保v SOUND_ON變量可用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM