Android Studio - Hotkey for navigating to xml declaration is instead navigating to R file
Android Studio - Hotkey for navigating to xml declaration is instead navigating to R file
Original Title: What is the hotkey, if any, for navigating to layout file or a resource's value?
(This question didn't really describe the issue at hand. And as you can imagine, it attracted some obvious answers. My apologies, this is the first question I've posted.)
I'm using Android Studio version 1.1.0 on Mac.
Say I have a line of code similar to this:
setContentView(R.layout.layout_main);
In Eclipse, I could simply use 'command + click' on the resource ID and it would navigate to the respective xml file then highlight the string, view, or color declaration. However, doing so in Android Studio navigates me to the declaration within the R file, which is utterly useless.
Is there a separate hotkey that I missed, or a separate event/action I could bind the current hotkey to, that would cause AS to operate more like Eclipse in this manner?
EDIT
After a couple answers -- which were correct according to the original question -- and some experimentation (created a fresh new project - I feel silly for not doing that earlier), it seems Android Studio should in fact navigate to the exact line in the xml where the View, String, or Color resource is declared, just like Eclipse does. However in my situation, it isn't for some odd reason.
This is merely speculation, but I suppose the culprit could be one or a combination of three things:
- The project I was working on - It was recently migrated from an Eclipse project to Android Studio project. This seems to be the most likely since the issue persists after updating items 2 and 3.
- The JDK version - When I created the new project, AS complained that my compiler was outdated (was running 1.6, upgraded to 1.7).
- Target SDK - the reason I was prompted to upgrade the JDK.
Answer by Catalina for Android Studio - Hotkey for navigating to xml declaration is instead navigating to R file
CTRL + B should do it. Otherwise you can create your own shortcuts.
Answer by Mohammad Arman for Android Studio - Hotkey for navigating to xml declaration is instead navigating to R file
I am using Mac (OS X Yosemite).
Holding down the Command + Tapping the id of an Item is taking me to the xml right now.
But another shortcut is point your cursor over the ID and click Command + B
If you want to go to the class file from the xml then click Command + O I can share some additional shortcuts: Command + E for recent files.
If you want to search from the recent list Then click "Shift" twice
Answer by Amir for Android Studio - Hotkey for navigating to xml declaration is instead navigating to R file
in windows Ctrl+B switched between Design Mode and Text Mode.
Ctrl + leftClick moves to declaration
Answer by user3829751 for Android Studio - Hotkey for navigating to xml declaration is instead navigating to R file
So I figured it out! I don't know why, but it turns out that my main project's root folder (main 'app' module) was on the file type ignore list. All you have to do is remove the folder name from the list (highlighted in picture below).
Oddly enough, this also resolved some the other anomalies I was experiencing. One issue was I could never see the AndroidManifest file in 'manifests' folder of the Hierarchy/Project Viewer ('Android' selected). Another issue was whenever I'd build and run the app, I'd get a warning about the AndroidManifest and have to click "Continue Anyway". Also, the app wouldn't auto-launch once installed.
Answer by jayeffkay for Android Studio - Hotkey for navigating to xml declaration is instead navigating to R file
My problem was that I, after recently changing the package name, accidentally added a blank space in the Manifest package name.
Answer by ralphspoon for Android Studio - Hotkey for navigating to xml declaration is instead navigating to R file
In Android Studio you can just click "Shift" button twice. You can either open java Class, xml layout, gradle files, android manifest and almost everything. hope it helps.
-cheers / happy codings.
Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72
0 comments:
Post a Comment