安卓三星I9000小号屏幕大小和密度的问题 [英] Android Samsung S I9000 screen size and density issues

查看:155
本文介绍了安卓三星I9000小号屏幕大小和密度的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题,对三星I9000小号的应用程序。在我的应用程序的按钮是远远大于他们应该。此外,该系统是选择资源/值小/作为值的来源。总而言之,它充当如果设备有一个非常小的屏幕,即使它的所谓800×480(我在横向模式下工作)。其实,我可以通过更改值RES /值小/ styles.xml改善情况比我当时已经在使用更小的字体大小。

I'm having problems with an app on the Samsung S I9000. The buttons on my app are much larger than they should be. In addition, the system is selecting res/values-small/ as a source of values. All in all, it's acting as if the device has a very tiny screen, even though it's supposedly 800x480 (I'm working in landscape mode). In fact, I can improve the situation by changing the values in res/values-small/styles.xml to even smaller font sizes than I was already using.

显示指标如下:

 density = 2.0
 scaledDensity = 2.0
 densityDpi = 320
 widthPixels = 800
 heightPixels = 480
 xdpi = 320.0
 ydpi = 320.0

任何人都可以解释为什么在设备扩展我的显卡了这么多,作为如果我有一个非常小的显示器?更重要的是,如何解决呢?

Can anybody explain why the device is scaling my graphics up so much and acting as if I have an extremely small display? More importantly, how do I fix it?

我试着调整我的清单设置minSdk和targetSdk最近发布,但都没有效果。删除值小/导致应用程序使用默认值/相反,这只能让情况变得更糟。

I've tried tweaking my manifest to set minSdk and targetSdk to a recent release, but that had no effect. Deleting values-small/ caused the app to use the default values/ instead, which only made the situation worse.

推荐答案

请务必使用SP的字体和休息的DP

Always use "sp" for font and rest as "dp"

将您的图像对应的文件夹,如下

place your image in corresponding folder as below

假设你正在为MDPI使用36x36的图像,你需要使用

suppose your are using 36x36 image in for mdpi you need to use

drawable-mdpi - 36 x 36
drawable-hdpi - 48 x 48
drawable-xhdpi  72 x 72

3:4:6:8

有一些情况下,您可能不希望的Andr​​oid以pre-规模的资源。为了避免pre-缩放最简单的方法是将资源的资源目录与nodpi配置预选赛。

There are some situations in which you might not want Android to pre-scale a resource. The easiest way to avoid pre-scaling is to put the resource in a resource directory with the nodpi configuration qualifier.

例如:

res/drawable-nodpi/icon.png

例如

您使用的字体大小14sp意味着它会自动为320 DPI更改为

you are using an font size as 14sp means it will automatically change for 320 DPI as

14×320÷160 =28

所以,现在你的字体大小是28dp为xhdpi分辨率的手机。

so now your font size is 28dp for xhdpi resolution phone.

这篇关于安卓三星I9000小号屏幕大小和密度的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆