- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 SenchaTouch2 开发 Android 应用程序。我使用一个 480px 宽的 png 文件作为背景图像以适应 GalaxySII,它有 480px 宽度。它在浏览器中非常好,但在我导出为 native 应用程序后,背景变得更大并且超出了可视范围。
经过一些观察,如果我想适应 480px 的屏幕,你的原始图像应该是 320px,这是 1/3 的差异。请让我知道谁可以设法显示原始宽度 n 高度的背景。
谢谢!
最佳答案
听起来您的 WebView 正在执行缩放。也就是说,默认比例 1.0 等于一个 mdpi 设备。 Galaxy SII 是 hdpi 设备,比例为 1.5。因此,您的 480 像素图像正在变为 480 像素 * 1.5 或 720 像素,以及为什么 320 像素看起来像您想要的。
尝试像这样指定视口(viewport)使用设备的 native DPI:
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width"/>
或者,您可以将其指定为:
<meta name="viewport" content="target-densitydpi=device-dpi, initial-scale=1.0"/>
您可以在以下位置阅读有关设置视口(viewport)以针对 Android 设备的更多信息:http://developer.android.com/guide/webapps/targeting.html
请注意,如果您随后遇到字体问题,则需要按照我对 font size different on ios and android 的回答中的步骤进行操作。
另请注意,对于 Sencha Touch 2,他们似乎关闭了此自动视口(viewport)设置:http://www.sencha.com/forum/showthread.php?184219-Viewport-Meta-Tags-not-injected-automatically
关于android - 为什么 SenchaTouch 2 中使用的图像比正常尺寸大 1/3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9732942/
嗨,我一直在寻找 secnhatouch 字段的 readOnly 属性,但没有找到它......有人可以帮助我解决这个问题吗 { xtype: 'textfield
我已经构建了一个破损的工作示例 here 。第一次加载页面时,默认值将加载到表单中。当您更改数据并刷新时,将显示上次更改的值。但是,在第一次页面查看(再次刷新)之后,不会保留进一步的更改,因为它看起来
我正在 SenchaTouch 中创建一个应用程序。另外,我将使用 PHONEGAP 为 ios、android 和黑莓进行部署。在应用程序中,我需要打印一些详细信息,例如收据。我不知道如何使打印功能
我不熟悉使用 Sencha Touch 开发 Android 应用程序。按照 Hybrid applications using phonegap and sencha touch 中的文档进行操作我
在过去的几个小时里,我一直在努力弄清楚如何让它发挥作用,但我很挣扎。 我目前正在尝试制作一个具有四个选项卡按钮的应用程序,每个选项卡按钮都有自己的视口(viewport)js文件,这工作正常,但是在其
我是phonegap开发环境的新手,我想使用Sencha touch来构建我的iPhone应用程序。请有人指导我如何使用sencha touch来构建我的iPhone应用程序?我想要步骤,我将如何在
我在尝试使用 Sencha Touch 和 PhoneGap 构建 Android 应用程序时遇到问题。 我正在使用 PhoneGap v1.2.0、Sencha Touch 2.0.0 pr3 构建
我正在使用 SenchaTouch2 开发 Android 应用程序。我使用一个 480px 宽的 png 文件作为背景图像以适应 GalaxySII,它有 480px 宽度。它在浏览器中非常好,但在
我有一个数据存储,它从我服务器上的 JSON API 获取信息。当我在 WebKit/Chrome 中运行代码时,一切似乎都运行良好,但如果我将用户代理更改为 iPhone 4.1 等,则似乎 JSO
当您想要使用 localStorage 时,您应该如何在应用程序中保存/加载设置?假设我们只想保存用户名和密码。 目前我知道两种选择: 使用带有存储和代理的模型。 这似乎有点太“大”,因为您只想存储一
背景:我在所有 View 中使用相同的工具栏,该工具栏是在单独的 View 中定义的。该工具栏有四个按钮。由于该按钮具有 'id' 属性, View 中一个按钮上的点击事件也会触发其他 View 中类
我是一名优秀的程序员,十分优秀!