如何启用"提取字符串资源" Android Studio中弹出窗口?

时间:2015-05-07 11:05:35

标签: android android-layout android-studio

在Android Studio中将TextView添加到布局xml文件中时,使用" Extract String Resource"非常方便。将字符串名称添加到strings.xml。但不管怎么说,无论是单击还是按Alt + Enter(Windows 8操作系统),它都不会出现在弹出窗口中。

有什么东西可以让弹回来吗? 这是弹出窗口现在的截图。

enter image description here

2 个答案:

答案 0 :(得分:2)

当属性是您希望字符串的值或不存在的字符串引用时执行操作,例如:

android:text="oh hi!"

android:text="@string/this_doesnt_exist_yet"

答案 1 :(得分:1)

如果在字符串文字上按alt输入时未出现该选项,则可能已禁用它。在Android Studio 3.1.4中,可以通过选择Help/Find Action...(Ctrl-Shift-A)并搜索“提取字符串资源”来启用它。设置的实际路径是File/Settings/Editor/Intentions/Android/Extract string resource。无论哪种方式,您都希望启用它。