有没有办法在 Android Studio 中为 java 文件提取带有自动生成资源名称的字符串?

2024-05-07

在 Android Studio 中,Alt + Enter > java 文件中的“提取字符串资源”将打开以下窗口:

Please note that the Resource name field is blank. However, the window will be like the following for a layout XML file: enter image description here

请注意,资源名称字段会自动填充。

如何也用自动生成的 java 文件名称填充资源名称字段?

它认为在当前版本的 Android Studio (2.1) 之前,所有类型的文件都会自动填充资源名称,但我可能是错的。

[编辑]2018年5月29日: 我想强调的是,问题是关于“自动生成的资源名称”,而不是关于是否可以提取硬编码字符串。从java文件中提取硬编码字符串一直是可用的,但自动名称生成不存在。


您可以使用该软件自动执行此操作https://www.jetbrains.com/help/idea/2016.2/recognizing-hard-coded-string-literals.html https://www.jetbrains.com/help/idea/2016.2/recognizing-hard-coded-string-literals.html

我的链接有误(感谢您给我带来了坏名声),但是这个问题被重复了很多次......

我希望这对你有帮助,下次,想想我们花时间只是为了帮助别人。祝你好运朋友!

如何在 Android Studio 中找到所有相关的硬编码字符串? https://stackoverflow.com/questions/31485214/how-can-i-find-all-relevant-hard-coded-strings-in-android-studio

在 Android Studio 中自动生成 @String 引用 https://stackoverflow.com/questions/16977208/auto-generate-string-reference-in-android-studio

Android:资源字符串自动生成 https://stackoverflow.com/questions/12219299/android-resource-string-automatic-generation

可以突出显示硬编码的字符串文字并在它们之间导航吗? https://stackoverflow.com/questions/24426440/possible-to-highlight-hard-coded-string-literals-and-navigate-between-them

如何在 Android Studio 中找到我的项目中的所有硬编码字符串 https://stackoverflow.com/questions/25043809/how-can-i-find-all-hard-coded-strings-in-my-project-in-android-studio

在 Intellij 中将 Android 代码中的字符串提取到 strings.xml 文件中的快捷方式是什么? https://stackoverflow.com/questions/13304339/what-is-the-short-cut-to-extract-strings-from-android-code-into-the-strings-xml

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

有没有办法在 Android Studio 中为 java 文件提取带有自动生成资源名称的字符串? 的相关文章

随机推荐