2013-05-31 33 views
3

我使用jQuery Mobile和PhoneGap創建了一個移動應用程序。當我在Windows Phone 7仿真器上運行應用程序時,它會以預期的寬度顯示。 http://post.robfine.com/jqueryapponwindowsphoneemulator.pngjQuery Mobile/PhoneGap應用程序在Android設備上顯示非常廣泛,但不在WP7仿真器中

但是,當我創建一個apk並在我的android設備上測試應用程序時,它顯示的寬度要大得多。 http://post.robfine.com/jquerymobileappsowideandroid.jpg

從我的研究中,一切都指向了我已經處理過的視口元標記。

<!DOCTYPE html> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
     <meta name="format-detection" content="telephone=no" /> 
     <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> 
     <link rel="stylesheet" type="text/css" href="css/index.css" /> 
     <title>Circle of Death 2.0</title> 
     <meta name="apple-mobile-web-app-capable" content="yes" /> 
     <meta name="apple-mobile-web-app-status-bar-style" content="black" /> 
     <link rel="stylesheet" href="css/jquery.mobile-1.3.1.min.css" /> 
     <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script> 
     <script type="text/javascript" src="js/jquery.mobile-1.3.1.min.js"></script> 
     <script type="text/javascript" src="cordova-2.7.0.js"></script> 
     <script type="text/javascript" src="js/GameLib.js"></script> 
    </head> 
    <body> 
     <div class="app" id="deviceready"> 
      <div data-role="page" id="page1"> 
       <div data-role="content"> 
        <div> 
         <img src="img/CircleOfDeath2Title.png" alt="Circle of Death" width="100%" /> 
        </div> 
        <div style="text-align: center; padding: 10px;"> 
         <img src="img/cardback.png" alt="Card Deck" onclick="DrawCard();" id="CardDeck" /> 
        </div> 
        <div> 
         <h2 id="RuleTitle" style="margin:0px;"></h2> 
        </div> 
        <div> 
         <span id="Directions"></span> 
        </div> 
       </div> 
      </div> 
     </div> 
    </body> 
</html> 

當使用PhoneGap和jQuery Mobile時,有其他人看到過這個問題嗎? 在此先感謝。

+0

你有很多的東西,在你的視口代碼,我的PhoneGap應用工作在Android中使用'' – Nelson

+0

這就是機票!我用你的視口替換了我的視口元標記,現在看起來不錯。謝謝尼爾森。 – Rob

回答

5

你有很多的東西,在你的視口代碼,我的PhoneGap的應用程序正常工作的機器人只是下面的視口代碼:

<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1"> 
相關問題