Android : How to set the correct viewport for every device - android phonegap

on Tuesday, October 14, 2014


i tried to figure out a problem since this morning and just 30 Minutes ago i got it work.


My problem was the viewport beeing ignored on android KitKat. I changed my CordovaActivity.java to the new one directly from GitHub and after that my ViewPort worked the right way. If i set the values:



initial-scale=2.5, maximum-scale=2.5, minimum-scale=2.5


i can zoom in or zoom out my app to make it fit the screen. So...next step: How do i realise, that the viewport automaticaly changes to fit the screen?


If i set it the scales to 1 and set width=device-width, height=device-height nothing changes.


I would like to have a solution, which makes the app fit on every screen/device till Android 4.1. So, Devices with lower target-lvl get ignored.


This is what my Viewport looks like:



<meta name="viewport" content="user-scalable=no, initial-scale=2.5, maximum-scale=2.5, width=device-width, target-densitydpi=device-dpi" />


and this is my CordovaActivity.java -> http://pastebin.com/fYPwsMJN


I hope someone can help me and figure out, how to make it fit to every screen.


0 comments:

Post a Comment