I am trying to adapt and migrate an old project to PhoneGap.
So far, the project works correctly in Android browsers, but it does not work with PhoneGap, since it does not adapt the content to fit the entire screen. He always leaves an empty space, and thatβs not what I want. PhoneGap does not seem to pay attention to my viewport property in the meta tag that I use.
I did some tests to find out the problem without any result.
For example, the following test contains only two files: index.html and config.xml
It contains a DIV with a width of 276 pixels, and I would like PhoneGap to let it fit the entire page, as Android browsers do.
By the way, I use the PhoneGap Build website to create this test online.
Here is the contents of the index.html file (I am not using DOCTYPE to make it simpler, but even using it will not work properly):
<html> <head> <meta name="viewport" content="width=276, user-scalable=yes" /> <title>Title</title> </head> <body> <div style="width:276px; background-color:orange;">I want to make this div fit to the page</div> </body> </html>
And this is the contents of the config.xml file (note that the EnableViewportScale parameter is set to true, but even if it is set to yes, this will not work):
<?xml version="1.0" encoding="UTF-8" ?> <widget xmlns = "http://www.w3.org/ns/widgets" xmlns:gap = "http://phonegap.com/ns/1.0" id = "com.phonegap.example" versionCode="10" version = "1.0.0"> <name>PhoneGap Example</name> <description> An example for phonegap build docs. </description> <author href="https://build.phonegap.com" email=" support@phonegap.com "> Hardeep Shoker </author> <preference name="EnableViewportScale" value="true" /> </widget>
So. Is there something I'm doing wrong? How can I archive what I'm trying to do? I am sure this should have a fairly simple solution, but I cannot find it right now.
Thank you in advance and sorry for my English, this is not my native language.
Cheers, Joan