我有使用 Android 库 (com.appocaliptic.quizknife.core) 的 Android 项目 (com.appocaliptic.quizknife.app)。
我想要做的是获取图片的资源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 中有可绘制和对应的属性。