Jov*_*van 2 android android-studio
我想使用 setImageResource 加载图像,从原始文件夹到 imageview,但我收到 Expected Resource of type Drawable 错误。
我正在使用 android studio,之前我使用 Eclipse 时一切都很好。我不想使用可绘制文件夹。

原始文件夹:

有什么建议吗?谢谢
小智 5
你可以尝试一下
InputStream imageStream = this.getResources().openRawResource(R.raw.name);
Bitmap bitmap = BitmapFactory.decodeStream(imageStream);
imageview.setImageBitmap(bitmap);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7006 次 |
| 最近记录: |