Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I jump to XML resources in Eclipse instead of R.java

  • Eclipse version: Indigo Service Release 2
  • ADT version: 18.0.0.v201203301601-306762

I have the following code in Eclipse

View view = inflater.inflate(R.layout.somelayoutfile, parent, false);

I want to perform some action, like CTRL+Click on "R.layout.somelayoutfile" and it jump to that xml file. Instead it takes me to "R.java."

According to this the Android Documentation this should be supported, but it doesn't work. Does anyone know why, and/or how to enable this feature?

like image 998
Coltin Avatar asked Apr 25 '12 23:04

Coltin


2 Answers

The most efficient way.
Eclipse settings - Hyperlinking - Open Declaration - uncheck.

CMD+Click will start to navigate you directly to XML instead of R class.

Eclipse hyperlinking settings

You'll still be able to use the Open Declaration by pressing F3.

like image 198
oxied Avatar answered Oct 05 '22 07:10

oxied


If you hold Ctrl with the pointer over the resource name (somelayoutfile in your example) then a menu should appear, with two options:

  • Open declaration
  • Open declaration in layout/somelayoutfile.xml

That isn't working for you? Or you want the default (direct click on the resource name) to be the second option?

like image 34
Chopin Avatar answered Oct 05 '22 09:10

Chopin