在Android Studio中自动生成@String引用

b1k*_*jsh 47 android intellij-idea android-studio

我知道这可以通过遵循以下建议在eclipse中实现:Android:resource String自动生成

但我似乎无法找到这在Android工作室是否可行.有人知道怎么做吗?

基本上我想采用硬编码字符串并在我的main values.xml或strings.xml中自动创建@string引用.

Cra*_*der 117

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

提取

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:

XML提取资源

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.

  • 它是一个完全不同的IDE,有自己的选项集.您可以在[设置|中启用] Eclipse键盘映射 Keymap](http://img560.imageshack.us/img560/8154/20130608142429.png),但其他一些选项可能无法转移.如果您熟悉Eclipse并对它感到满意,那么您可能不需要Android Studio. (3认同)

Mic*_*ick 21

上述答案中似乎缺少的是,在Android Studio中,您必须将光标放在字符串中,单击鼠标,然后按Alt + Enter以显示"提取字符串资源"对话框

  • Alt + Enter不会在2.2.3中显示提取资源对话框.有人知道怎么做吗? (2认同)