在Android的不同值的文件夹文件夹、不同、Android

2023-09-11 12:30:30 作者:狗友很狗i

我创建不同的在我的应用程序(值,值,LDPI,价值观MDPI,价值观,华电国际,价值观xhdpi文件夹,价值观nodpi,价值观w360dp-MDPI)。但有些设备属于同一类别。但具有不同的屏幕尺寸。但我看到,根据器件密度给予的字体大小的这个答案通过@PankajSharma提供建议创建一个类似文件夹 -

I am creating different values folders in my app (values, values-ldpi, values-mdpi, values-hdpi, values-xhdpi, values-nodpi, values-w360dp-mdpi). But some devices that belong same category. But having different screen sizes. But I see give font size according to device densities in this the answer provided by @PankajSharma suggest to create folders like-

res/values/dimens.xml    
res/values-small/dimens.xml    
res/values-normal/dimens.xml    
res/values-xlarge/dimens.xml

我想知道什么是B / W我的方式和其他方式的区别?我想通过@PankajSharma提供的答案很简单。我也想知道哪种方式更好呢?

I want to know what is the difference b/w my way and the other way? I think the answer provided by @PankajSharma is easy. I also want to know which way is better?

推荐答案

您正在使用的方法是一种有效的方法,但有点过时了。从蜂窝,还有的新的方式来解决这一切。你的资源文件夹现在应该是这样的:

The approach you are using is a valid approach, but a little outdated. From HoneyComb, there is a new way to fix all of this. Your resources folder should now look like this:

请参考我已经发布的链接,并熟悉最小宽度的概念。

Please refer to the link I have posted and familiarize yourself with Smallest Width concept.

希望这有助于:)

编辑:添加到这个帖子,尝试建立某种标准化在你的 dimens.xml ,是这样的:

Adding to this post, try to establish some kind of standardization in your dimens.xml, something like this:

这样做可以更容易维护code,再加上它减少了文件夹的数量。通常情况下,而不是值,华电国际值-xhdpi 等,如值时─文件sw480dp-xhdpi 可能有更多的价值进行调整,但话又说回来这一切的是语境。

Doing this makes it easier to maintain code, plus it reduces the number of dimen folders. Normally rather than having values-hdpi, values-xhdpi, etc. files like values-sw480dp-xhdpi might have more values to adjust, but then again all of this is contextual.