不同屏幕尺寸的不同字符串

时间:2016-05-24 12:07:15

标签: android android-resources android-screen-support

我有两个设备: 首先是320x480px 3.5“ 第二个是540x960px 5.3“

我希望第一个显示较短的字符串,所以我添加:

<span> <input type="text" style="overflow:auto" ng-model="selected" typeahead="item for item in filterInput($viewValue)"> </span>

values-ldpi/strings.xml

但是第二个设备仍在显示修改后的字符串,但显然不是正常尺寸,而是更接近hdpi范围。为什么会这样?

编辑:

所有字符串都位于values / strings.xml中。 对于“小”(第一)设备,我需要覆盖一些字符串要短一些,但第二个设备应该使用默认值,所以我将重写的字符串放入 values-normal-mdpi/strings.xml values-ldpi/strings.xml 但第二个设备选择覆盖字符串。为什么? 这是设备参数

first device enter image description here

1 个答案:

答案 0 :(得分:1)

而不是使用DPI来区分设备屏幕,而是使用smallnormallarge等。因此,您的res文件夹将包含:

res/values/strings.xml
res/values-small/strings.xml
res/values-normal/strings.xml
res/values-large/strings.xml
res/values-xlarge/strings.xml

尝试一下,让我们知道它是否有帮助。

相关问题