安卓:用数字绘制资源。可能吗?数字、资源

2023-09-07 11:44:45 作者:丶猫腻

我想知道如果我可以,不知何故,创建绘制资源(PNG例如)呼吁787.png。由于Eclipse不会让我编译该项目,除非我修改它。

I would like to know if i can, somehow, create a drawable resource (png for example) called 787.png. Because Eclipse wont let me compile the project unless i modify it.

在此先感谢。

推荐答案

你不能有一个数字名称的资源的原因是因为变量名称不能以数字开头。对于每个资源,有一个产生恒定变量(在R.java)与该资源的名称。如果你看一下你的Eclipse项目中,在根文件夹,你会看到R.java

The reason you can't have a resource with a numeric name is because variable names cannot start with numbers. For each resource, there is a generated constant variable (in R.java) with the resource's name. If you look in your Eclipse project, under the "gen" folder you will see R.java

这是我的理解,它是不可能有一个纯数字名称的资源,在Android项目。

It is my understanding that it is not possible to have a resource with a pure numeric name in an android project.

如果你能解释一下为什么你需要一个数字资源,也许我们可以提供替代解决方案。

If you explain why you require a numeric resource, maybe we can provide alternative solutions

 
精彩推荐
图片推荐