1

如果我以业余爱好者的身份出现,我很抱歉,但我确实是其中之一。在使用视口缩放 phonegap 时,我有点困惑。我有点困惑如何使用视口进行缩放,也许我只是想多了。这是我的代码:

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

我正在尝试使应用程序跨平台缩放相等,但我不确定是否应该使用像素或百分比,以及文本如何正确缩放。我希望一切都以百分比完成,但我觉得边距、填充和文本的百分比不能正确扩展。因此,我考虑尝试使用像素创建应用程序,只需使用数学来计算出我需要的像素比率。

抱歉,我是新手,我一遍又一遍地用谷歌搜索,只是不明白如何正确缩放它而不会遇到文本太大或边距关闭等问题。

4

1 回答 1

0

Think of the initial-scale and maximum-scale settings as zoom levels. You want initial-scale to be 1 and maximum-scale to be however much you want the user to be able to zoom in (ie. pinch to zoom). The user-scalable setting just says if you want the user to be able to scale the app by using pinch-to-zoom.

My typical setting is this:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

This says that the starting scale is 1.0 (normal) and that the user can not scale (default or no value = false). As I don't allow scaling, there is no need for me to have a maximum-scale parameter.

Hope that helps

于 2013-10-16T21:41:44.667 回答