51Testing软件测试论坛

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

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


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 :


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:

Shortcut :


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 :


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 :


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 :


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

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







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