R.drawable无法解析图像 [英] R.drawable cannot resolve image
本文介绍了R.drawable无法解析图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我也查了很多计算器上的问题和我似乎有所有正确的事情,但我R.drawable不会发现我的形象。它是在/ RES /绘制和所有其他文件夹(MDPI,华电国际等)
ShipImage = context.getResources()getDrawable(R.drawable.player)。
和这里是我的R.java
公共静态final类绘制{
公共静态最终诠释背景= 0x7f020000;
公共静态最终诠释按钮= 0x7f020001;
公共静态最终诠释死了= 0x7f020002;
公共静态最终诠释敌人= 0x7f020003;
公共静态最终诠释ic_launcher = 0x7f020004;
公共静态最终诠释为play_btn = 0x7f020005;
公共静态最终诠释球员= 0x7f020006;
}
解决方案
你确定你输入进口com.yourcompanyname.product.R
?
而不是
进口android.R;
I have checked a lot of questions on stackoverflow and I seem to have all the correct things but my R.drawable wont detect my image. It is in /res/drawable and in all the other folders (mdpi, hdpi etc.)
ShipImage = context.getResources().getDrawable(R.drawable.player);
And here is my R.java
public static final class drawable {
public static final int background=0x7f020000;
public static final int buttons=0x7f020001;
public static final int dead=0x7f020002;
public static final int enemy=0x7f020003;
public static final int ic_launcher=0x7f020004;
public static final int play_btn=0x7f020005;
public static final int player=0x7f020006;
}
解决方案
Are you sure You import import com.yourcompanyname.product.R
?
instead of
import android.R;
这篇关于R.drawable无法解析图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文