我如何找到在Android Studio中使用方法或变量的位置(快捷方式) [英] How can i find where a method or a variable is used in Android Studio (shortcut)

查看:435
本文介绍了我如何找到在Android Studio中使用方法或变量的位置(快捷方式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我知道如何使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆