Android Studio Development Skills Collection 1

Android Studio Development Skills Collection 1

About Android Studio's key mapping

Android Studio provides different keymaps (i.e. the mapping between shortcut keys and their corresponding operations). You can view the currently used keymap in the " Settings->Keymap " menu.

Highlight all identical variables

OS X: Command + Shift + F7
Windows Or Linux: Ctrl + Shift + F7

This shortcut will highlight all occurrences of the selected characters in the current file. Of course, this shortcut is not just some simple pattern matching, it also understands the scope of the current variable and only highlights the relevant characters.

After highlighting, you can use the shortcuts defined at " Edit → Find → Find Next/Previous " to select the highlighted characters you want to operate on.

Related Tips:

  • Highlighting a "return" or "throw" in a method will also highlight all exits of that method.
  • Highlighting the "extends" or "implements" definition part of a Java class will also highlight the corresponding overridden or implemented methods.
  • Highlighting an import statement will also highlight where it is used.
  • Esc can cancel the highlight.

Jumping between methods and inner classes

OS X: Ctrl + /
Windows Or Linux: Alt + /

This shortcut allows you to easily jump to the method or class in the current file.

If you are currently in a method, this shortcut (up) will allow your cursor to jump to the method name. This is very helpful when you are refactoring code or finding where this code is used.

Class file structure pop-up window

OS X: Command + F12
Windows or Linux: Ctrl + F12

This shortcut key can help you display the method structure of the current class file. You can use this shortcut key to pop up a pop-up window and search for the method name you want.

Related Tips:

  • You can use camelCase characters to filter the candidate method list. For example, enter "oCr" to find the "onCreate" method.
  • You can choose whether to show anonymous classes. If you check "Yes", you can easily find the OnClick method in OnClickListener.

Method call level pop-up window

OS X: Ctrl + Alt + H
Windows Or Linux: Ctrl + Alt + H

This shortcut helps you show how the method is called.

Defining Quick Finds

OS X: Alt + Space
Windows Or Linux: Ctrl + Shift + i

If you want to immediately know the source of a class or method without losing your current coding environment, you can try this shortcut.

Collapse or expand code blocks

OS X : Alt + + / -
Windows Or Linux: Ctrl + Shift + + / -

See the picture on the right for the specific effect.

Related Tips:

  • You can customize your code folding scope in " Editor → Code Folding ".

Bookmark to save your code site

Default Tags
OS X: F3
Windows Or Linux: F11 Press this shortcut key to label the line where your cursor is currently located.
Labels with letters or numbers
OS X: Alt + F3
Windows Or Linux: Ctrl + F11

Press this shortcut key to label the line where your cursor is currently located, and provide a letter or number label. If you choose a number label, you can jump directly to the corresponding position by pressing ctrl+the corresponding number.

Display Tags
OS X: Command + F3
Windows Or Linux : Shift + F11

Find Android Studio's menu options

OS X: Command + Shift + A
Windows Or Linux: Ctrl + Shift + A

You can search for any menu option by typing the menu name, which is useful for operations that are rarely used.

Related Tips:

  • If there is a shortcut for this option, the shortcut will be displayed next to the list.

Line-of-code movement

OS X: Alt + Shift + /
Windows Or Linux: Alt + Shift + /

Use this shortcut key to move the code in a row, either up or down. The effect is as shown below.

Deleting a row

OS X: Command + Backspace
Windows Or Linux: Ctrl + Y

Delete the current line or selected code.

<<:  Mobile email APP Mail Master plays the warmth card to create a warm winter version for users

>>:  Get rid of the following bad habits and give your Android phone a new lease of life

Recommend

Humans learn throughout their lives, but the brain can only store 4GB?

In life, we often hear an inspiring saying, "...

iPhone 6 won’t be sold in China: Apple, please tell me something

Apple's iPhone 6 has passed a key regulatory ...

How many technology companies are needed to host a modern Olympic Games?

The Rio Olympics has been open for two days, and ...

Zhihu promotion and traffic generation skills!

There is a saying that is often circulated on the...

Working is actually a hundred times harder than starting a business

In fact, I really hate topics like entrepreneursh...

This deadly poison is the origin of all life

Before oxygen appeared on Earth, the environment ...

The ultimate sales trick for big players

Introduction to the resources of the best sales p...

Android-side permission privacy compliance practices

[[419042]] What is For the client, permission pri...