Android Studio - Hotkey to go to xml declaration is go to R file

Original title: What hotkey, if any, is to navigate to the layout file or resource value?

(This question did not actually describe the problem. And, as you can imagine, this attracted some obvious answers. My apologies, this is the first question I posted.)

I am using Android Studio version 1.1.0 on Mac.

Let's say I have a line of code like this:

setContentView(R.layout.layout_main); 

In Eclipse, I can simply use the + click command in the resource identifier and it will go to the corresponding xml file and then highlight the line, view or color declaration. However, this is done in Android Studio, which translates me into a declaration in the R file That is completely useless.

Is there a separate hotkey that I missed, or a separate event / action to which I could bind the current hotkey to make AS work like Eclipse this way?

EDIT

After a couple of answers that were correct according to the original question - and some experiments (created a new new project - I feel stupid that I didnโ€™t do this before), it seems that Android Studio should actually go to the exact line in xml. where a View, String, or Color object is declared, as Eclipse does. However, in my situation this is not for some odd reason.

This is just speculation, but I believe that the culprit may be one or a combination of three things:

  • The project I was working on was recently migrated from an Eclipse project to an Android Studio project. This seems most likely, as the problem persists after updating points 2 and 3.
  • JDK version. When I created a new project, AS complained that my compiler was deprecated (1.6 works, upgraded to 1.7).
  • Target SDK is the reason I was asked to update the JDK.
+6
source share
7 answers

CTRL + B should do this. Otherwise, you can create your own shortcuts.

+5
source

In Android Studio, you can just press the Shift button twice . You can open the java class, xml layout, gradle files, android manifest and almost everything. I hope this helps.

- checks / lucky encodings.

+3
source

I am using a Mac (OS X Yosemite).

Holding the command + Clicking on the element identifier leads me to xml right now.

But another shortcut points to your cursor over the identifier and press Command + B

If you want to go to the class file from xml, press Command + O I can share some additional shortcuts: Command + E for the latest files.

If you want to search from the last list, then click "Shift" twice

+2
source

in windows Ctrl + B switches between design mode and text mode.
Ctrl + leftClick moves to ad

+2
source

So I get it! I donโ€™t know why, but it turns out that my main project root folder (main module "app") was on the file type ignore list. All you have to do is remove the folder name from the list (highlighted in the image below).

Oddly enough, this also fixed some other anomalies that I experienced. One of the problems was that I could never see the AndroidManifest file in the "manifestests" folder in the "Hierarchy / Project" application ("Android" selected). Another problem was that when I created and launched the application, I received a warning about AndroidManifest and had to click "Continue Anyway". In addition, the application will not automatically start after installation.

Ignore list

0
source

My problem was that, after changing the name of the package, I accidentally added an empty space in the name of the Manifest package.

0
source

Command + B works for Mac For Windows, I'm not sure that I am not using Windows.

0
source

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


All Articles