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.
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..
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.id
s 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.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With