您的位置:首页 > 移动开发 > Android开发

Android Studio 使用技巧(5)

2015-06-02 01:22 621 查看
转载请注明本文出自Cym的博客(http://blog.csdn.net/cym492224103),谢谢支持!




About Keymaps

Android Studio provides different keymaps (the mapping between shortcut keys and an action). You can see which keymap you are using in Settings->Keymap.

It wouldn’t be practical to list the shortcuts for every keymap so the following will be used:

Windows: Default

Linux: Default

OSX: Mac OSX 10.5+


Enter vs Tab for Code Completion



There is an interesting difference whether you use code completion with tab or with enter.

Using enter will complete the statement as you would expect. Using tab will complete the statement and delete everything forward until the next dot, parenthese, semicolon or space.

Shortcut (during code completion): enter or tab


Navigate to parent



If you are in a method that is overriding a parent class (e.g. Activity#onCreate()), this will navigate to the parent implementation.

If you are on the class name, it will navigate to the parent class.

Shortcut :

Mac: Cmd+U

Windows/Linux: Ctrl+U


Return to the Editor



A bunch of shortcuts will take you away from the editor (type hierarchy, find usages, etc.)

If you want to return to the editor, your options are:

Escape: This will simply return the cursor to the editor.

Shift+Escape: This will close the current panel and then return your cursor to the editor.

Shortcut :

Return and keep panel open: Escape

Close panel and Return: Shift+Escape


Jump to Last Tool Window



Sometimes, you return to the editor from a panel but find yourself having to go back to this panel. e.g. browsing find usages. With this, you can go back to a panel without your mouse.

Shortcut: F12 (might interfere with the OS’s default keybindings)


Hide All Panels



Puts the editor in some sort of full screen mode. Invoking the shortcut a second time returns all panels to their previous state.

Shortcut :

Mac: Cmd+Shift+F12

windows/linux: Ctrl+Shift+F12


Open a Panel by Its Number



You might have noticed that some of the panels have a number to the left of their name. This is a shortcut to open them!

Just in case you don’t see the panel names, click the box thing in the lower left corner of the IDE.

Shortcut :

Mac: Cmd+Number

windows/linux: Alt+Number


Parameter Info



This is the same list of parameter names as the one that appears when you are writing a method call. It is useful when you want to see an existing method’s params.

The Parameter under your cursor will be in yellow. If nothing is in yellow, that means that the method call is not valid, probably something that is not casted right (e.g. a float in an int param).

When you are writing a method call and you dismiss it by accident, like I usually do, you can also type a comma (,) to trigger the parameter info.

Shortcut :

Mac: Cmd+P

windows/linux: Ctrl+P


The Switcher



So this thing is pretty much the alt+tab / cmd+tab of the IDE. It allows you to navigate to a tab or a panel.

Once it is opened, as long as you hold the ctrl key, you can navigate quickly by using the number or letter shortcut. You can also close a tab or a panel by pressing backspace when it is selected.

Shortcut: Ctrl+Tab


Context Info



So this will show you where you are when your scope definition is out of the scrolling area. Usually, this will be the name of the class or inner class but it might also be the current method name.

Its better use, IMO, is to get a quick look at what the current class extends or implements.

It also works in xml files.

Shortcut: Ctrl+Shift+Q
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: