Android 视图某些设备上的边框问题
已解决的主题:答案如下。
一些用户报告了某些 Android 组件(例如警报弹出窗口或 editTexts)的边框对齐问题。这种情况发生在 Samsung Galaxy Apollo (200x400) 和 HTC Pro Touch (480x640) 设备上。我无法复制这一点,因为我不拥有这些设备,并且在 Samsung Galaxy S 和模拟器中,一切看起来都很好。
我认为问题在于设备的 dpi 或分辨率(因为 edittext 背景是单个 .9.png,所以图像看起来应该没问题);但是我不确定 supports-screens 标签是否是解决方案。此外,应用程序是使用 Api 3 (v1.5) 开发的,尚不支持 supports-screens,也不支持屏幕尺寸资源限定符。
用于警报和编辑文本的样式是手机默认样式。问题可能与用户应用到手机的主题有关吗?
预先感谢!,我展示了一些给我的显示问题的图像:
TOPIC Solved: Answer below.
Some users have been reporting border alignment issues on some android components such as the alert popup or the editTexts. This is happening on the Samsung Galaxy Apollo (200x400) and the HTC Pro Touch (480x640) devices. I cannot replicate that because i don't own those devices and in the Samsung Galaxy S and emulator everything looks just right.
I think that the problem is the dpi or resolution of the device (because the edittext background is a single .9.png so image should look ok); however I am not sure if the supports-screens tag is the solution. Also, application was developed using Api 3 (v1.5) and supports-screens was not yet supported, nor the screen-size resource qualifier.
The style used for the alerts and editText is the phone default. Could the problem be something related with the theme applied to the phone by the user?
Thanks in advance!, I show some images given to me showing the problem:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
实际上可能是显示密度造成的。如果您没有提供适当密度的资源,框架将尝试重新缩放您的图像,包括 9 个补丁。不幸的是,没有真正完美的方法来调整 9patch 的大小,它有时会导致伪影,尽管如果它导致您所看到的伪影类型,我会感到非常惊讶。
It might actually be the display density causing this. If you don't provide assets in the appropriate density, the framework will try to rescale your images, including 9patches. Unfortunately there's no real perfect way of resizing 9patches and it can sometimes lead to artifacts, although I would be very surprised if it caused the type of artifact you are seeing.
我遇到了同样的问题,解决方案是将
TextView
的字体大小从 16px 更改为 17px (或任何其他 奇数)。I've had the same problem and the solution was changing the font size of the
TextView
from 16px to 17px (or any other odd number).嗯,这确实是分辨率/密度。我设法创建了一个具有 WQVGA 密度的模拟器(需要 > Android 1.6)并复制了错误。
该解决方案可在 Android 开发者网页的支持旧版应用程序部分中找到:http://developer.android.com/guide/practices/screens_support.html。因此项目中需要更新版本的 API,但它仍然支持 1.5 版本。
谢谢。
Well it really was the resolution/density. I managed to create an emulator with the WQVGA density (which needed > Android 1.6) and replicate the error.
The solution is seen on the Supporting Legacy Applications section of the Android Developers webpage: http://developer.android.com/guide/practices/screens_support.html. So a newer version of the API is needed in the project but it still holds support for the 1.5 version.
Thanks.