Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the XML files from R.id or R.layout in Android?

I use Eclipse to study some open source projects on Android. I keep seeing R.id.xxx or R.layout.xxx in the Java source code. And I see that they are built from XML files in the /res folder.

But the problem is that there are hundreds of XML files that can contain the ID that I want to see. Is there any method to see this reference rather than look through every XML file manually?

Thanks in advance.

like image 475
PhatHV Avatar asked Jul 02 '12 04:07

PhatHV


3 Answers

just hold the ctrl key and place the mouse over the R.id.xxx or R.layout.xxxxx. Eclipse will show the option as

      open Declaration
      open Declaration in Layout/xxxx.xml

By clicking open Declaration in layout/xxx.xml it will leads to the layout file.. if you choose open Declaration, it will goes to declartion part in R.java

i hope it will helpful to you..

like image 199
deepa Avatar answered Oct 24 '22 09:10

deepa


R.layout is the actual layout file R.id is a view that is inside the layout.

The only way that a view can be called is if the layout is first inflated.

So my project has to say R.layout first, and then R.ids from inside that layout can be used.

The answer to this question might help you: What is the correct term when calling a widget from xml in Android?

It basically explains that the layout file has to be "opened" first before all of the views (buttons, editText, TextViews, etc) inside can be used.

Holding ctrl while clicking will point you where it came from.

like image 25
EGHDK Avatar answered Oct 24 '22 08:10

EGHDK


Try this...

1. Open the R.java file,

2. Hold the ctrl button on your keyboard

3. And place your mouse pointer on integer constant whose xml you want to trace.

4. Then select the option "Open declaration in the layout layout_name"

like image 2
Kumar Vivek Mitra Avatar answered Oct 24 '22 10:10

Kumar Vivek Mitra