是否有可能在Android的一个特定的密度访问绘制? [英] Is it possible to access a drawable from a specific density in Android?

查看:210
本文介绍了是否有可能在Android的一个特定的密度访问绘制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据课程的情况下,我通常为每个密度我的应用程序支持和正确的密度绘制的可绘制,当我使用一些绘制的ID参考使用。

Depending on the situation of course, I normally have a drawable for each density my app supports and the right density drawable is used when I use an id reference of some drawable.

但我希望从一个特定的密度接入的可绘制(例如,LDPI)无论密度运行在设备上。但我想这对一个具体的情况,而不是无处不在,这会破坏其每个密度多可绘制的目的。

But I'm looking to access a drawable from a specific density (for example, ldpi) no matter the density running on the device. But I want this on a specific situation, not everywhere, that would defeat the purpose of having multiple drawables for each density.

这可能吗?

推荐答案

我不知道这是可能的或没有,但作为一个简单的逻辑。

I dont know that it is possible or not but as a simple logic.

您只是使LDPI绘制,并将它命名mypic2的复制并将其保存在文件夹LDPI

You just make a copy of that ldpi drawable and name it mypic2 and keep it in ldpi folder.

从XML或活动现在给新mypic2的引用您的具体情况

now from your xml or activity give the reference of that new mypic2 at your specific situation.

这篇关于是否有可能在Android的一个特定的密度访问绘制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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