Android Studio 使用技巧(5)
2015-06-02 01:22
621 查看
转载请注明本文出自Cym的博客(http://blog.csdn.net/cym492224103),谢谢支持!
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+
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
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
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
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)
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
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
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
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
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
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
相关文章推荐
- Android Studio 使用技巧(4)
- Android Studio 使用技巧(3)
- Android Studio 使用技巧(2)
- Android Studio 使用技巧(1)
- 关注Android安全 手机锁屏勒索国内首现身
- android天气1
- android天气2
- Android项目的目录结构
- ADT中添加libs下的jar包,增加了reference library,而没有增加Android private library的
- android 新浪微博登录获取access_token值的问题
- android studio引入第三方jar包
- marki-制作.9格式的素材图片
- Android Resources$NotFoundException: String resource ID #0x1
- Android动画之translate(位移动画)
- Android 实现记住用户名和密码的功能
- [016] 如何使用真机调试Android应用
- [014] Android应用程序签名详解
- [015] Android平台的专业术语
- [013] 百度地图API之城市POI搜索-获取所有结果(Android)
- [012] 百度地图API之公交换乘方案搜索(Android)