不知道你修改到R中之的值是什么东西,额外写方法抛出数据不行吗? 比如创建一个全局类,然后“类名.属性”这样的。 public class RewriteR{ public static int EULA_1 = 0; public static int EULA_2 = 1; }然后RewriteR.EULA_1这样类似的。
这么修改的确可以在R中生成对应的ID了,但是strings.xml文件又提示错误了Multiple annotations found at this line: - ERROR A 'name' attribute is required for <string> - ERROR Resource entry is already defined.
在布局xml添加+id 就会在r里面自动生成
LZ如果String.xml里面字符串资源定义地无误的话 应该是没问题的
Multiple annotations found at this line: - ERROR A 'name' attribute is required for <string> - ERROR Resource entry is already defined. <string android:name="stringname">value</string>android:name 属性不能为空不能重复
是啊,但是我src里的EULA.java文件有三个变量提示要在R中声明,但是我不知道怎么弄呵呵,楼上帮帮忙给讲一下吧。
比如创建一个全局类,然后“类名.属性”这样的。
public class RewriteR{
public static int EULA_1 = 0;
public static int EULA_2 = 1;
}然后RewriteR.EULA_1这样类似的。
我的值类型是string,请问上面的代码是加到含有Activity的那个主文件里么?我是菜鸟,不太懂呵呵。
在values/strings.xml定义相关的string,这边会自动在R.java生成对应的ID。
- ERROR A 'name' attribute is required for <string>
- ERROR Resource entry is already defined.
LZ如果String.xml里面字符串资源定义地无误的话 应该是没问题的
- ERROR A 'name' attribute is required for <string>
- ERROR Resource entry is already defined.
<string android:name="stringname">value</string>android:name 属性不能为空不能重复
ding
至于,楼主所说的,在strings.xml中定义的也会出错。估计是你没有按格式来定义你的字符串。
<string name="XXX"> </string>
下面给个例子:
<TextView
android:id="@+id/textview_display" 注意这一句的写法
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20px"
android:textStyle="bold"
/>
@id/textview_display 不带是引用R文件中已经定义好的变量
试一试 Projct-Properies-clean
然后再 Projct-Build Project
可能会好
试一试 Projct-Properies-clean
<resources>
<string name="hello">Hello World, SendGmailActivity!</string>
<string name="app_name">SendGmail</string>
</resources>
不知道怎么修改的就别说话,真是站着说话不腰疼。
求正解
所以,最好不用动他.
出了问题,可以project-->clean下