如果我在布局XML中有以下内容:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="string Test" />
它标记第4行“硬编码字符串应该使用@string资源”
很好,我知道,并希望。是否有选项可以选择此行并让IDE自动将<string></string>
添加到strings.xml并替换android:text=
以引用该资源?
答案 0 :(得分:0)
是的,通过选择文本并让IDE自动完成工作,可以选择执行此操作,感谢JAL:
How to add string resources in Eclipse?
顺便说一下,在JAL的回答中,当他说GO TO REFACTOR时,他的意思是菜单栏中的REFACTOR,而不是右键单击上下文菜单。