Question

I have created a mobile app using jQuery Mobile and PhoneGap. When I run the app on a Windows Phone 7 emulator, it displays at the expect width. http://post.robfine.com/jqueryapponwindowsphoneemulator.png

However, when I create an apk and test the app out on my android device, it displays at a much larger width. http://post.robfine.com/jquerymobileappsowideandroid.jpg

From my research, everything points to the viewport metatag, which I already have handled.

<!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>

Has anybody else seen this issue when using PhoneGap and jQuery Mobile? Thanks in advance.

Was it helpful?

Solution

You have a lot of stuff in your viewport tag, my phonegap apps work fine in android just with the following viewport tag:

<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top