如何找到在 Android Studio 中使用方法或变量的位置(快捷方式) [英] How can i find where a method or a variable is used in Android Studio (shortcut)
问题描述
例如,我知道如何通过使用 ctrl + 左键单击某个方法来查找源,但是如果我想查找使用该方法的位置怎么办?我使用的是 Windows 7.
I know how to find the source by using ctrl + left click on a method, for example, but what if I want to find where this method is used? I'm using Windows 7.
假设我有以下方法:
class A {
public int sum(int a, int b) {
return a+b;
}
}
我正在使用这种方法
class B {
...
a.sum(c, d);
...
}
我想找到我在A
课上使用sum
的地方.
and I want to find where I used sum
while I was in class A
.
PS:我是 Android Studio 的新手(大约一个月前开始使用它).
PS: I'm new to Android studio (started using it about a month ago).
推荐答案
在 Android Studio 中,突出显示该方法并右键单击 > 查找用法或使用 Alt+F7 快捷方式.
In Android Studio, highlight the method and either right click > Find usages or use the Alt+F7 shortcut.
Ctrl+左键单击在方法上可用于查找该方法最初声明的位置
Ctrl+left click on a method is useful for finding where that method was initially declared
这篇关于如何找到在 Android Studio 中使用方法或变量的位置(快捷方式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!