如何解决" itemTag不能得到解决或不是可以在现场与QUOT ;? [英] How to solve "itemTag cannot be resolved or is not a field"?
本文介绍了如何解决" itemTag不能得到解决或不是可以在现场与QUOT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在strings.xml档案,我有这样的:
<资源>
<字符串名称=itemTag> 1 LT; /串>
<字符串名称=item2Tag> 2'; /串>
< /资源>
但是,当我通过这个进入活动,并尝试访问:
ib.setTag(R.string.itemTagitemTag);
它给出了一个错误在itemTag:
itemTag不能得到解决或不是场
这是什么意思,我该如何解决呢?
编辑:code:
公共无效changePicture(IB的ImageButton){ib.setTag(R.string.itemTagitemTag);
。getResources()的getString(R.string.itemTag);
}
解决方案
检查你的java 导入
S,你可能已经导入了<$ C $ C> R.java 来一个在当前包不同。
删除所有进口则<大骨节病>控制骨节病> + <大骨节病>移骨节病> + <大骨节病> 0 骨节病>与Eclipse(整理进口),并选择正确的包导入。
In the strings.xml file, I have this:
<resources>
<string name="itemTag">1</string>
<string name="item2Tag">2</string>
</resources>
But when I go into an activity and try to access via this:
ib.setTag(R.string.itemTag, "itemTag");
It gives an error over itemTag:
itemTag cannot be resolved or is not a field
What does this mean and how can I solve it?
EDIT: Code:
public void changePicture(ImageButton ib) {
ib.setTag(R.string.itemTag, "itemTag");
getResources().getString(R.string.itemTag);
}
解决方案
Check your java import
s, you may have imported a R.java
different to the one in your current package.
Remove all your imports then Ctrl+Shift+O (Organise imports) with Eclipse and chose the correct packages to import.
这篇关于如何解决&QUOT; itemTag不能得到解决或不是可以在现场与QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文