What is a shortcut for finding use of XML file in android studio?

As you know, there are many useful shortcuts that improve coding speed.

One of them finds using a class or method that works with Alt + F7 or Ctrl + b . they work on methods and class names, but I wonder how I can find the use of an XML file, such as "Layout without search" in the project, and use "Find Use".

Since the name of the XML file is not in the file Like classes, and I'm always looking for its name in the whole project. I searched Google but could not find an answer.

+5
source share
3 answers

All keys are given for windows.

CTRL + F to search for keywords in a single file

You can do it like Find XML Usage | ALT + F7 after selecting XML layout

enter image description here

There is another way (not sure if you will like it). Try removing xml and it will not be deleted the first time. It will show you that all of its uses will be asked to confirm the deletion. You can see all the customs on the terminal, so you can find all of them.

enter image description here

click the browse button to display them all

For any shortcut, File → Settings → Keymap → (you can even select the Eclipse / Visual Studio shortcut types in android studio)

Here are some default shortcuts for Windows

Code Format | CTRL + ALT + L

Add Unrealized Methods | CTRL + I

Show logcat | ALT + 6

Build | CTRL + F9

Build and Run | CTRL + F10

Find | CTRL + F

Find in project | CTRL + SHIFT + F

Find and replace | CTRL + R

Find and replace in the project | CTRL + SHIFT + R

Override Methods | CTRL + O

Show project | ALT + 1

Hide project - logcat | SHIFT + ESC

Collapse all | CTRL + SHIFT + NumPad +

View Debugging Points | CTRL + SHIFT + F8

Expand all | CTRL + SHIFT + NumPad -

Open Settings | ALT + s

Select Target (open the current file in the Project view) | ALT + F1 → ENTER

Worldwide Search | SHIFT → SHIFT (double shift)

Code | Environment | CTRL → ALT + T

Create method form of selected code | ALT + CTRL

+7
source

My personal preferences are ctrl + shift + f . It will display a popup dialog where you can enter what you are looking for and it will look in the entire project folder.

As an alternative, there is already a Find Usage feature in xml when you right-click on it. And it shows the file that uses it.

enter image description here

In my example, I found using my analytics_debug.xml , then the mini-console below will show which file uses it. Selecting a file in the usage console redirects you to the exact line of code in which the XML is called.

I reproduce this information in Ubuntu 16.04, AS version 2.1.1 .

+4
source

From the IntelliJ IDEA documentation :

Search for usage in the current file

To find the use of a character in the current file:

  • Select the desired character in the editor or in the Structure view.
  • In the main menu, select "Edit | Find | Find the use in the file or press Ctrl + F7 . The detected use is highlighted in the editor.

But this one did not work on Linux , use ALT + F7 instead

+2
source

Source: https://habr.com/ru/post/1261862/


All Articles