android The method getText() is undefined for the type R.string

2025-05-15 18:06:23
推荐回答(2个)
回答1:

我出现的问题是The method getText() is undefined for the type String 不知道和你的是不是一样。我出错的原因是声明编辑文本的变量和声明Strng的变量一样了。把变量名换了就对了

回答2:

如果你在编译Android项目的时候发生下面错误
The method getTextContent() is undefined for the type Element, 一般原因是你选择了Android project target版本太低,getTextContent()与setTextContent()是高版本Android的提供的,修改方法一是提升Android的版本,或者你可以用getFirstChild().getNodeValue()来替换。