简体   繁体   English

如何在 Android Studio 中搜索字符串的所有文件?

[英]How to search all files for a string in Android Studio?

In Android Studio ( IntelliJ ) how do you execute a 'File Search' for a string within a Scope of files?在 Android Studio ( IntelliJ ) 中,如何对文件范围内的字符串执行“文件搜索”? Can Search Everywhere do this, I only see how to use it to search 'code', not 'files' Can Search Everywhere这样做,我只看到如何使用它来搜索“代码”,而不是“文件”

Example: Search for the string "Dummy Button" in the 'Workspace Scope'.示例:在“工作区范围”中搜索字符串“虚拟按钮”。

Expected Response: res/values/string.xml:line4预期响应: res/values/string.xml:line4

You can do it in two ways,你可以通过两种方式做到这一点

Goto Menu -> Edit -> Find -> Find in Path转到Menu -> Edit -> Find -> Find in Path

在此处输入图片说明

Or use the shortcut,或者使用快捷方式,

ctrl+shift+f

In Android Studio,在 Android Studio 中,

  1. On a Windows or Linux based machine use shortcut Ctrl + Shift + F to search any string in whole project.在基于 Windows 或 Linux 的机器上,使用快捷键Ctrl + Shift + F在整个项目中搜索任何字符串。 It's easy to remember considering Ctrl + F is used to search in the current file.考虑到Ctrl + F用于在当前文件中搜索,很容易记住。 So just press the Shift as well.所以也只需按下Shift 键

  2. On OSX use the Command key instead of Ctrl .在 OSX 上,使用Command键而不是Ctrl

  3. Use Ctrl + F combination for Windows and Linux to search in current file. Windows 和 Linux 使用Ctrl + F组合在当前文件中搜索。

  4. Use Shift + Shift (Double Tap Shift ) combination for Windows and Linux to search Project File of Project.对于 Windows 和 Linux,使用Shift + Shift (双击Shift )组合来搜索项目的项目文件。

  5. Command + Shift + F on Mac to find in path Mac 上的Command + Shift + F在路径中查找

Try this.尝试这个。 Enter your string name in dialogue box after pressing ctrl+shift+fctrl+shift+f后在对话框中输入您的字符串名称

菜单栏->编辑->查找->在路径中查找...

按两次 Shift 按钮并在搜索框中输入它将在整个 Android Studio 中搜索。

In my case, I accidentally checked the box of "File mask".就我而言,我不小心选中了“文件掩码”框。 So all xml files are not searchable in Find in Path.所以所有的 xml 文件都不能在 Find in Path 中搜索。 Maybe this can help you.也许这可以帮助你。 在此处输入图片说明

在 Android Studio 4.1 更新中,Mac 用户的组合发生了变化,现在您应该使用Control + Shift + f

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM