可以强制用于选择资源的屏幕分辨率吗?
中描述的资源选择机制
在我们的 Android 中,我们对不同的屏幕分辨率使用不同的布局,使用http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources
这效果很好,除了某些报告错误的设备屏幕尺寸。
特别是,我们希望在 Kindle Fire 和 Nook 平板电脑上使用相同的分辨率。它们具有 600x1024 屏幕,因此应将自己报告为具有“大”屏幕。 Kindle Fire 这样做,但 Nook 平板电脑选择“xlarge”资源:
http://nookdeveloper.zendesk.com/entries/20814001-emulator-loads-xlarge-layout
我可以检测到应用程序正在运行在 Nook 平板电脑上,并为其添加特殊情况,但我还没有找到如何强制资源选择机制为特定屏幕尺寸选取资源。
In our Android we use different layouts for different screen resolutions, using the resource selection mechanism described at
http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources
This works great, except for some devices which report the wrong screen size.
In particular we would want to use the same resolution on the Kindle Fire and the Nook Tablet. These have 600x1024 screens and thus should report themselves as having "large" screens. The Kindle Fire does so, but the Nook Tablets picks the "xlarge" resources:
http://nookdeveloper.zendesk.com/entries/20814001-emulator-loads-xlarge-layout
I can detect that the application is running on a Nook Tablet, and add a special case for it, but I have not found how I can force the resource selection mechanism to pick up resources for a certain screen size.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的解决方案(您可能没有寻找)是没有可用于 Nook 版本的大量资源。这会导致两个 Nook 设备加载相同的资源。这就是我所做的,但由于我没有进行大量的巨大更改,这对我来说没什么大不了的。
遗憾的是,Android 直到 3.2 才解决这个问题,它具有最小宽度选择器而不是旧的存储桶系统。不过,Nook 的版本仍保持在 2.3.4 版本,因此如果您想要更好的尺寸选择系统,则需要自行推出。
就我个人而言,我对 10 英寸平板电脑的定位不如 7 英寸平板电脑,因为目前最畅销的是 Kindle Fire 和 Nook 设备。 Nook 的高调可能值得创建一个单独的版本。
The simple solution (that you're probably not looking for) would be to not have an XLarge set of resources available for the Nook release. This causes both Nook devices to load the same resources. That's what I did, but since I didn't have a great set of XLarge changes this wasn't a big deal for me.
Sadly, Android didn't fix this issue until 3.2, which has minimum width selectors rather than the old bucket system. Nook is hanging tight at 2.3.4, though, so you'll need to roll your own if you want a better size selection system.
Personally, I haven't targeted 10" tablets as much as 7" tablets, because the top sellers are currently the Kindle Fire and Nook devices. The high profile of Nook may make it worth creating a separate build.