Phonegap jQueryMobile Theme on android

2019-08-04 13:25发布

问题:

Here I am and I need your help. I've been working on Android applications for a few months and today the enterprise asks me to use Phonegap as to create a hybride app.

I'd like to try some themes with ThemeRoller but when I try to input the files in my app, something goes wrong : the theme doesn't apply ! Well, this is partly true because if I look at the app using my web Browser, the theme applies perfectly but when I build & run the app on my phone, the text will appear as if there weren't any CSS.

Why only on the phone ? I've been looking around the web and even found That link ! It's exactly the same question as mine but I tried what worked for him and nothing good happened to me, no new result, no change at all.

So here is the header of my index.html :

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>jQuery Mobile: Theme Download</title>
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
    <link rel="stylesheet" href="web-holo/AndroidHoloDarkLight.min.css" />
    <link rel="stylesheet" href="jquery.mobile.structure-1.3.2.min.css" />
    <link rel="stylesheet" href="roboto/fonts.css" />
</head>

And here is the website I found the theme on : That Web Site I input the Theme folder in WWW but anyway the code found it since the Desktop web browser displays it correctly...

Thanks for your help !

回答1:

I got the answer thanks to Aliassse !

The probelm was the WhiteList ! I was creating my app from a basic application found on the web which "www/config.xml" file was modified. Indeed I could see at the end of the xml file :

<access origin="http://127.0.0.1*"/> <!-- allow local pages -->

This means that the app can only access to local pages, not online. And I needed to access pages like :

http://code.jquery.com/jquery-1.9.1.min.js

So in order to solve that, I changed the broken line to :

<access origin="*"/>

I built the app again, run it on my device and it worked ! A heavy thanks to Aliassse for being that fast and efficient !