后空翻测试结果
早上好,
我把我的应用程序安装在 Backflip 上并开始测试它。在模拟器上一切正常,但在后空翻上有一些显着的差异。
我有编辑文本框,它们在模拟器上会自动改变大小以适应文本。文本为数字,最多两位数,即1-99。在后空翻中,编辑框的宽度似乎是固定的,并且该宽度大于所需的宽度。因此,某些编辑文本框超出了屏幕末端,无法使用或看到。这不会发生在模拟器上。
我也有旋转器。使用 android.R.layout.simple_spinner_dropdown_item 创建一组微调器,并由 array.xml 中的数组填充。这些微调器显示单选按钮,并且它们可以在模拟器和后空翻上运行,显示白色背景和黑色文本。
另一个微调器是使用 int layoutID = android.R.layout.simple_spinner_item 创建的,并使用 ArrayAdapter 使用数据库中的字符串填充。该微调器在模拟器上显示正常,具有白色背景和黑色文本。然而,在后空翻时,它显示白色背景,但带有白色文本,使得列表基本上无法看到。该列表已填充,因为当我按下某个项目时,背景颜色变为红色,文本为白色,并且程序运行正常。
我的问题是:这些差异是后空翻特有的还是我在代码中做错了什么?我不愿意认为所有设备都具有需要解决方法的特殊性。希望我做错了什么,并希望有人能指出它是什么。我会发布任何有人想看到的代码,但现在我不知道该发布什么。谢谢。
[编辑] 我应该补充一点,当我使用 android.R.layout.simple_spinner_dropdown_item 作为另一个微调器时,文本显示正常,但我现在有了我不想要的单选按钮。
Good Morning,
I got my app to install on the Backflip and started testing it. On the emulator everything appeared ok but on the Backflip there are a few notable differences.
I have edittext boxes which on the emulator automatically vary in size to accommodate the text. The text is a number, the max being two digits, i.e., 1-99. On the Backflip the edit boxes seem to be a fixed width and that width is larger than needed. Consequently some of the edittext boxes go past the end of the screen and can't be used or seen. This doesn't happen on the emulator.
I also have spinners. One set of spinners is created using android.R.layout.simple_spinner_dropdown_item populated by an array from array.xml. These spinners have the radio button showing and they work on both the emulator and the Backflip displaying a white background with black text.
The other spinner is created using int layoutID = android.R.layout.simple_spinner_item and is populated with strings from the database using an ArrayAdapter. This spinner displays ok on the emulator with a white background with black text. On the Backflip however, it displays the white background but with white text making the list essentially impossible to see. The list is populated because when I press on an item the background color changes to red, the text is white, and the program works ok.
My question is: Are these discrepancies peculiar to the Backflip or am I doing something wrong in the code? I'd hate to think all devices come with peculiarities that require workarounds. Hopefully I'm doing something wrong and hope someone can point out what it is. I'll post any code someone wants to see but right now I don't know what to post. Thanks.
[Edit] I should add that when I use android.R.layout.simple_spinner_dropdown_item for the other spinner the text shows up ok but I now have the radio buttons which I don't want.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要将
android.R.layout.simple_spinner_item
用于下拉项,因为这不是它的用途。使用 android.R.layout.simple_spinner_dropdown_item ,或将该布局复制到您的项目中(在 SDK 平台目录之一的 data/res/layout/ 中),将其修改为适合,并使用它。至于为什么会出现行为差异,摩托罗拉似乎针对 MOTOBLUR 手机修改了一些库存资源以满足他们的需求。虽然这些资源通常会起作用,但它们只会针对其应有的用途进行测试。依赖
android.R.layout
资源通常会起作用,但前提是这些资源按预期使用。如果您想完全控制,请制作自己的副本。Do not use
android.R.layout.simple_spinner_item
for the drop-down item, since that is not what it is supposed to be used for. Useandroid.R.layout.simple_spinner_dropdown_item
, or copy that layout into your project (indata/res/layout/
in one of your SDK platform directories), modify it to suit, and use it.As to why the behavior difference, Motorola, for the MOTOBLUR handsets, appears to have modified some of the stock resources to fit their needs. While those resources will generally work, they will only have been tested for things they are supposed to be used for. Relying on
android.R.layout
resources will generally work, but only if those resources are used as intended. If you want full control, make your own copy.