我的Phonegap/Cordova应用程序在iPhone 4/4S(640x960),HTC Desire HD(480x800),三星Galaxy Note等设备上看起来不错.
<meta name="viewport" content="user-scalable=no, initial-scale=0.75, maximum-scale=1, minimum-scale=0.75, width=device-width, height=device-height, target-densitydpi=device-dpi" />
Run Code Online (Sandbox Code Playgroud)
但它在三星Galaxy S4(1080x1920,5.0英寸~441 ppi像素密度)等超高分辨率设备上缩小太小,用户可能需要放大镜才能读取.
如何调整视口,使其在所有手机/平板电脑上看起来大小相同,而不管屏幕大小或像素密度如何?
我尝试将比例增加到1.5,它在S4上可读但是在低密度设备上一切都太大了.
任何的想法?
我在PhoneGap和内置浏览器下在Android上运行相同的Web应用程序.该应用程序在内置浏览器上运行良好,但在PhoneGap下运行速度令人难以置信.甚至页面上的基本滚动也会在PhoneGap下断断续续.
一般来说,我可能做错了吗?我的印象是PhoneGap只使用与普通浏览器应用程序相同的WebKit渲染器,那么为什么同样的HTML和JavaScript在PhoneGap中运行得慢得多?
我正在使用cordova InAppBrowser来显示我应用中外部网站的内容.当我在iPhone上打开浏览器时,InAppBrowser底部有一些按钮用于关闭它或来回导航.Android设备上的InAppBrowser没有这样的按钮,并且没有明显的方式让用户关闭浏览器.
我知道如何以编程方式关闭InAppBrowser,但是在使用Android设备时用户如何关闭它?
我知道用户能打到硬件后退按钮关闭浏览器,但(1)这不是直观的 - 后退按钮通常意味着"回去的网页",和(2)我最终想改变的行为返回按钮返回显示在InAppBrowser内部的站点内的页面,而不是关闭浏览器.
我按照PhoneGap 2.0.0中的说明开始使用iOS指南.它似乎没有更新到目前为止,因为创建的项目中的某些文件具有除指南之外的其他名称.除此之外,在建造时会发生警告和错误.
- 警告:检查依赖项:缺少依赖项目标"CordovaLib(来自CordovaLib.xcodeproj)"
- 错误:CpResource/VERSION /<...>/Test.app/VERSION cd /<...>/test-phonegap setenv PATH"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/ usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/ usr/bin:/ bin:/ usr/sbin:/ sbin"builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn - exclude .git -exclude .hg -resolve-src-symlinks -strip-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip/VERSION /<...>/Build/产品/调试-iphonesimulator/Test.app
错误:/ VERSION:没有这样的文件或目录
你有什么想法让它运作起来吗?谢谢和最好的问候.
- 指南:http://docs.phonegap.com/en/2.0.0/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS
我用phonegap(cordova 2.2)
我有这样的链接:
<a href="http://twitter.com/foobar" target="_blank">twitter</a>
Run Code Online (Sandbox Code Playgroud)
在iOS上 - 它在浏览器中打开链接(Safari)
但是在Android上 - 它在webview中打开(在我的phonegap应用程序中)
有没有办法使Android的工作方式与iOS相同?
我已经尝试为我的应用程序实现iscroll java脚本作为CSS 位置的补救过程:修复了在使用cordova 2.1.0的 android 2和3版本中不起作用
我从这里复制了iscroll-lite的javascript
HTML代码
<div id="wrapper" class="wrapper">
<div id="wrapper-container" class="wrapper-container">
<div id="header" class="header">
<div id="header_title" class="header_title"> </div>
<div id="abc" class="abc"><img src="img/abc.png""/> </div>
</div>
<div id="images" class="images"><img name="slide" src="img/abc.png" width=100%; />
</div>
<div id="description" class="description">
<div id="title" class="title">
<h1><strong></strong></h1>
</div>
<div id="desc" class="desc">
</div>
</div>
<div id="footer" style="background-image:url(img/bar.png);" class="footer">
<div id="footer_text" class="footer_text">footer_text</div>
<div id="image" class="image noSelect"><img src="img/info.png" onclick="info()"/></div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
desc标签的内容将溢出
CSS
.wrapper
{
position: absolute; width:auto; margin:0 auto; height:100%; overflow: …
Run Code Online (Sandbox Code Playgroud) 我已经开始为mutliple平台开发html应用程序.我最近听说过Cordova 2.0(PhoneGap),因为我一直很想知道这座桥是如何工作的.经过大量的代码遍历后,我看到Exec.js是JS - > Native调用的代码
execXhr = execXhr || new XMLHttpRequest();
// Changeing this to a GET will make the XHR reach the URIProtocol on 4.2.
// For some reason it still doesn't work though...
execXhr.open('HEAD', "file:///!gap_exec", true);
execXhr.setRequestHeader('vc', cordova.iOSVCAddr);
if (shouldBundleCommandJson()) {
execXhr.setRequestHeader('cmds', nativecomm());
}
execXhr.send(null);
} else {
execIframe = execIframe || createExecIframe();
execIframe.src = "gap://ready";
Run Code Online (Sandbox Code Playgroud)
但是想要了解它是如何工作的,这里的概念是什么,file:///!gap_exec或gap:// ready是做什么的?以及调用如何支持较低层(本机代码层)
提前感谢一堆.
我正在尝试使用Phonegap通知在我的Phonegap应用中显示错误消息,然后允许用户通过电子邮件发送错误.唯一的问题是我无法将错误消息传递给回调函数,导致电子邮件无效.
我现在的代码如下所示:
function displayError(errormsg) {
navigator.notification.confirm(
errormsg,
onConfirm,
'Error',
'Submit, Cancel'
);
}
function onConfirm(buttonIndex){
if (buttonIndex === 1){
alert(errormsg);
}
}
Run Code Online (Sandbox Code Playgroud)
哪个被调用displayError("Test")
,这会产生错误内容Test
.我想,然后传递errormsg
到onConfirm
,但我不知道如何做到这一点,或者如果它是可能的.
我正在考虑的一个可能的解决方案是:
function displayError(errormsg) {
test = errormsg
navigator.notification.confirm(
errormsg,
onConfirm,
'Error',
'Submit, Cancel'
);
}
function onConfirm(buttonIndex){
if (buttonIndex === 1){
alert(test);
}
}
Run Code Online (Sandbox Code Playgroud)
但是,errormsg
如果显示新错误,则不会更改.我确认了这一点,因为在模拟器设置中,我的应用程序抛出了两个错误.第一个在使用该方法时正常工作,传递test
,但接下来的第二个错误使用原始变量,而不是最新的变量.
cordova create <app_name>
.cordova platform add android
cordova ripple android
.我从文档中知道我可以设置eclipse并进行构建.(我不是在寻找这个)
但我无法使用该命令创建.apk文件cordova build android
.当我运行命令时,命令行上没有输出,命令刚刚结束.我找不到.apk文件.
有没有办法从命令行创建.apk文件?(寻找其他平台的建议)
谢谢,
我正在使用Phonegap Build签署一个Android应用程序
我收到以下错误:
Error - Keystore alias not recognized
Run Code Online (Sandbox Code Playgroud)
我用它在我的终端中创建密钥库:
keytool -genkey -v -keystore name.keystore
Run Code Online (Sandbox Code Playgroud)
-alias alias -keyalg RSA -keysize 2048 -validity 10000 -storepass密码
我应该用什么'名字'和'别名',我错过了什么?
谢谢.
cordova ×10
cordova-2.0.0 ×10
android ×4
ios ×2
javascript ×2
html ×1
html5 ×1
inappbrowser ×1
iscroll ×1
ripple ×1