【发布时间】:2011-12-15 07:20:56
【问题描述】:
我目前正在尝试测试现有应用程序与即将发布的 Amazon Kindle Fire 平板电脑的兼容性。他们说将模拟器设置为 600x1024 并将 LCD 密度设置为 169(https://developer.amazon.com/help/faq.html?ref_=pe_132830_21362890#KindleFire 尽管在电子邮件中他们说的是 160 而不是 169)并且它应该报告为“大”而不是“xlarge”(这是我从后面得到的并与他们的支持团队进行电子邮件交流,我抱怨它不起作用)。
当 Google 将此分辨率和 MDPI 列为“大”(http://developer.android.com/guide/practices/screens_support.html#testing) 时,Google 似乎在其关于测试多种屏幕尺寸的部分中支持这一点。但是,每当我将“layout-xlarge”文件夹与“layout-large”一起包含时,模拟器总是会加载“xlarge”。如果我将 LCD 密度更改为 240 之类的值,它会加载“大”而不是“xlarge”,但这不应该是正确的,我担心这意味着它无法在最终设备上工作。为了测试这一点,我采用了“Multi-Res”的 API-10 样本并创建了一系列上述布局文件夹,并且每次它加载“xlarge”(如果它存在)并加载“large”如果没有“大”。
所以,我的问题是我是否正确阅读了文档,或者我的模拟器是否因为亚马逊的人坚持认为它应该报告为“大”而出现了某种混乱,如果这是真的,它永远不会加载“ xlarge" 对吗?
这是我在多分辨率示例中的清单中的内容,我对此进行了修改以进行测试:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multires"
android:versionCode="1"
android:versionName="1.0">
<uses-permission
android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<activity
android:name=".MultiRes"
android:label="@string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:anyDensity="true"
android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />
</manifest>
【问题讨论】:
-
对于它的价值(在我看来并不多,因为它是一种黑客行为),我从亚马逊收到的最新回复说:
To override the configuration you would have to do the following in your activity onCreate method (before you load layouts or anything else). final Configuration config = new Configuration(context.getResources().getConfiguration()); config.screenLayout = (config.screenLayout & Configuration.SCREENLAYOUT_LONG_MASK) + Configuration.SCREENLAYOUT_SIZE_LARGE; context.getResources().updateConfiguration(context.getResources().getConfiguration(), context.getResources().getDisplayMetrics()); -
遇到了同样的问题,但此解决方案似乎不起作用 - Android 正在从 values-xlarge 而非 values-large 读取数据。
标签: android emulation resolution kindle-fire