51Testing软件测试论坛

标题: 【转载】 Android Studio 使用技巧(1) [打印本页]

作者: lsekfe    时间: 2016-4-28 13:42
标题: 【转载】 Android Studio 使用技巧(1)
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:

Highlight All the Thingscmd+shift+f7 ctrl+shift+f7

This will highlight every occurrence of a symbol in the current file. This is more than some simple pattern matching, it will actually understand the current scope and only highlight what is relevant.

You can then navigate up or down using the shortcuts from Edit → Find → Find Next/Previous

Additional tips:

Move Between Methods and Inner Classesctrl+up/down alt+up/down

This wil move your cursor to the name of the next method or class in the current file.

If you are in the body of a method, going up will put the cursor on its name. This can be very useful because it puts you at the right place to refactor or find the usages of this method.

The File Structure Popupcmd+f12 ctrl+f12

The idea here is to show an outline of the current class and navigate in it. The best thing about it is that you can filter using your keyboard. This is a very efficient way to go to a method you know by name.

Additional tips:

The Call Hierarchy Popupctrl+alt+h ctrl+alt+h

This will show you the possible paths between a method’s declaration and its invocations!

Quick Definition Lookupalt+space ctrl+shift+i

Ever wondered whats the implementation of a method or class but don’t want to lose your current context? Use this shortcut to look it up in place.

Collapse Expand Code Blockalt+plus/minus ctrl+shift+plus/minus

The goal of this feature is to let you hide things you don’t care about at the moment. In its simplest form, it will hide a whole code block (e.g. ignoring the import list when you open a new file). A more interesting use is that it will hide the boilerplate around simple anonymous inner classes and make it look like a lambda expression.

Additional tip:

Bookmarks!Toggle Bookmarkf3 f11
Toggle Bookmark With Mnemonicalt+f3 ctrl+f11

If you assign a number, you can go back to the bookmark using this shortcut: ctrl+number

Show Bookmarkscmd+f3 shift+f11

Find Actionscmd+shift+a ctrl+shift+a

You can invoke any menu or action known to Android Studio by its name! This is pretty useful for commands that you use once in a while but don’t have a shortcut for.

Additional tip:

Move Lines Up/Downalt+shift+up/down alt+shift+up/down

Yeah. This will move lines up or down. Not much more to say. Enjoy!

Delete Linecmd+backspace ctrl+y

It deletes the current line or selection.

本文出自Cym的博客(http://blog.csdn.net/cym492224103






欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2