我需要对 create/use drawable-nodpi 文件夹做更多的事情吗?
Do I need to do anything more to create/use drawable-nodpi folder?
我有一些我不打算缩放的图像,我读过它们应该在 drawable-nodpi 文件夹中。该文件夹在我的项目中还不存在。
我创建了它,并将图像移动到该文件夹中。在文件名旁边,它在括号中显示 (nodpi)。这是否意味着图像在加载到图像视图时不会缩放?这是否也意味着如果图像只是居中裁剪,则加载到图像视图中所需的内存更少?
是的,你是对的。图像不会根据设备密度进行缩放。这里摘自 documentation:
If you have some drawable resources that the system should never scale
(perhaps because you perform some adjustments to the image yourself at
runtime), you should place them in a directory with the nodpi
configuration qualifier. Resources with this qualifier are considered
density-agnostic and the system will not scale them.
并且不要忘记使用 png
文件类型而不是 jpeg
。
我有一些我不打算缩放的图像,我读过它们应该在 drawable-nodpi 文件夹中。该文件夹在我的项目中还不存在。
我创建了它,并将图像移动到该文件夹中。在文件名旁边,它在括号中显示 (nodpi)。这是否意味着图像在加载到图像视图时不会缩放?这是否也意味着如果图像只是居中裁剪,则加载到图像视图中所需的内存更少?
是的,你是对的。图像不会根据设备密度进行缩放。这里摘自 documentation:
If you have some drawable resources that the system should never scale (perhaps because you perform some adjustments to the image yourself at runtime), you should place them in a directory with the nodpi configuration qualifier. Resources with this qualifier are considered density-agnostic and the system will not scale them.
并且不要忘记使用 png
文件类型而不是 jpeg
。