Android 资源报错:has no declaration in the base values folder; this can lead to crashes when the resourc

背景:

我们在适配不同分辨率的时候,经常会对一些尺寸进行不同分辨率进行设置

我们在处理dimen是,发现报错,或者其他资源

The dimen "fxdimen_px_800" in values-sw393dp has no declaration in the base values folder; this can lead to crashes when the resource is queried in a configuration that does not match this qualifier

 原因:

是因为我们有一个默认的,在默认values没找到该资源的定义,也就是说,values是基础数据,其他的都是扩展数据,如果基础数据未有,其他分辨率出现了,就会报该资源出现异常。

如果我们指向适配基础和其他以外的某一个,只要在对应的分辨率下定义一个和基础values一模一样的即可。系统优先找指定的分辨率下的资源,如果未找到,会找基础数据的资源。

猜你喜欢

转载自blog.csdn.net/qq36246172/article/details/120883681
今日推荐