image我想像这样进入bitmap:
bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bug);
但这向我显示了错误R.drawable.bug,bug can not be resolve or is not a field请告诉我在哪里做错了。
image我想像这样进入bitmap:
bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bug);
但这向我显示了错误R.drawable.bug,bug can not be resolve or is not a field请告诉我在哪里做错了。
试试这个:
InputStream is = getResources().openRawResource(R.drawable.bug);
Bitmap pisc = BitmapFactory.decodeStream(new BufferedInputStream(is));
只需将您的 Drawable 复制到项目中的所有可绘制文件夹中即可。像这样 drawable-hdpi drawable-ldpi drawable-mdpi
文件夹中是否有bug图形文件drawable?您是否尝试过清理您的项目以便R.drawable正确生成?