Android views' borders issue on some devices

2019-05-21 12:51发布

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:

borders issue link img

3条回答
小情绪 Triste *
2楼-- · 2019-05-21 13:11

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楼-- · 2019-05-21 13:16

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.

查看更多
孤傲高冷的网名
4楼-- · 2019-05-21 13:23

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.

查看更多
登录 后发表回答