Androidライブラリ(com.appocaliptic.quizknife.core)を使用するAndroidプロジェクト(com.appocaliptic.quizknife.app)があります。Android - getIdentifierは常に0を返します(library + application)
私がやろうとしていることは、図書館である画像のリソース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");
編集:
のAch、およびR.javaに描画可能とcorensponding属性があります。
これをテストしているシステムで、解像度がxhdpiの画面がありますか? – Squonk
@Squonk - それはID自体を取得することに関係していません。 idに関連付けられているドロウアブルを取得するときだけです。さらに、描画可能なリソースの場合、システムは[best match](http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch)を見つけるので、xhdpiリソースを使用しますスケーリング)ldpiデバイスでも。 –
@TedHopp:はい、合意しました - 私はdrawableリソースのための最良のマッチを忘れていました。 – Squonk