自动生成的机器人工作室@String参考自动生成、机器人、工作室、String

2023-09-05 06:44:49 作者:我是你的蓝胖子

我知道这是可能的日食按照此处的建议:Android:资源字符串自动生成

I know that this is possible in eclipse by following the advice here: Android: resource String automatic generation

不过,我似乎无法找到,如果这是可能的机器人工作室呢。任何人都知道如何做到这一点?

But I can't seem to find if this is possible in android studio yet. Anybody know how to do this?

基本上我想采取强硬codeD字符串,并自动创建在我的主values​​.xml或strings.xml中一个@string参考。

Basically I would like to take a hardcoded string and auto create a @string reference in my main values.xml or strings.xml.

推荐答案

替代 + 输入,提取字符串资源当插入符号里面硬codeD字符串:

Alt+Enter, Extract String Resource while the caret is inside the hardcoded string:

同样应该在XML文件中工作,以及,和它的工作在IntelliJ IDEA的,但似乎在Android Studio的当前版本被打破:

The same should work in XML files as well, and it does work in IntelliJ IDEA, but seems to be broken in the current version of the Android Studio:

机器人工作室0.1.3示出了在它从字符串资源中提取的XML布局折叠文本,但它未能导航回到资源和不提供给从内的XML硬$ C $光盘字符串提取资源。这似乎是一个错误。

Android Studio 0.1.3 shows the folded text in XML layouts that it extracts from the string resources, but it fails to navigate back to the resource and doesn't offer to extract resources from the hardcoded strings inside XML. It appears to be a bug.

 
精彩推荐