转自:Android Studio 轻松整理字符串到string.xml中
1、首先代码中的字符串如下图所示:
![](https://img.haomeiwen.com/i1901463/4b33758818fe6513.png)
2、然后选中字符串“hello world”,同时按住Alt+Enter,即可看到弹出选择的对话款,选择其中的“Extract string resource”;
![](https://img.haomeiwen.com/i1901463/9310dc6abf2cffab.png)
3、选择之后,然后看到Extract Resource对话框,我这里直接填写字符串的名字为string;
![](https://img.haomeiwen.com/i1901463/c28ff8b8c1d8a542.png)
4、点击OK后,之前的字符串就成功整理到了string.xml文件中了,结果如图所示,而且不用担心手动的改动出错。
![](https://img.haomeiwen.com/i1901463/0647cc21f8e70dc5.png)
![](https://img.haomeiwen.com/i1901463/a6fceea1a7754fb0.png)
网友评论