Android views' borders issue on some devices

心已入冬 提交于 2019-12-22 12:38:15

问题


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:


回答1:


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.




回答2:


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).




回答3:


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.



来源:https://stackoverflow.com/questions/4692913/android-views-borders-issue-on-some-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!