我有一个Android项目(com.appocaliptic.quizknife.app),它使用了Android库(com.appocaliptic.quizknife.core)。
我尝试获取库中的图片资源id。该图片的路径为:res/drawable-xhdpi/fr_200_133.png
然而,使用getIdentifier方法的所有尝试都返回0。问题出在哪里?
resId = getResources().getIdentifier("fr_200_133", "drawable", "com.appocaliptic.quizknife.core");
resId = getResources().getIdentifier("com.appocaliptic.quizknife.core:drawable/"+"fr_200_133", null, null);
resId = getResources().getIdentifier("drawable/fr_200_133", null, "com.appocaliptic.quizknife.core");
编辑:
啊,而且在 R.java 中有 drawable 和对应的属性。