开发者

android: UI on real device problem

I wrote simple aplication for android. It works great in emulator. But when I installed it on real device (htc wildfire) then the interface became ugly. Except that it wo开发者_开发知识库rks good. TextViews look fine but the buttons, sprinners and list items look bad. Button corners seem wretched. All the lists (list view and list preference have no delimeter(line) between rows! When I scroll a bit the delimeter appears). Why?


The buttons probably become stretched because you're not using 9 patch images. Here's a good tutorial on 9 patch images http://developer.android.com/guide/developing/tools/draw9patch.html

Regarding the list view, you might want to set this field inside listview in your xml file
android:cacheColorHint="#00000000". That might do the trick.


Have you specified a targetSdkVersion in the uses-sdk tag in your manifest? If you haven't, Android will assume your app does not know about newer platform versions with different screen sizes/densities and run your app with compatibility scaling.

You should always set targetSdkVersion to the newest version of Android that you are targeting. This helps let Android know what compatibility behaviors to use for your app if things changed in newer versions. targetSdkVersion can be greater than minSdkVersion, meaning your app knows how to take newer platform features into account while remaining compatible with a minimum version.


Most likely, screen density is different on the device. Instead of specifying sizes in pixels (px), use sp for font size and dp for everything else. This way they will scale properly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜