Essential Tips for Using Android Studio

This article mainly shares some tips for using the Android development tool AS.

1. Color Schemes

1. Editor

solarized

Essential Tips for Using Android Studio

tomorrow-theme

Essential Tips for Using Android Studio

OneDark theme

Essential Tips for Using Android Studio

Monokai

Essential Tips for Using Android Studio

Custom DIY color scheme, (the code is an example of color settings)

Essential Tips for Using Android Studio

2. Console

Preferences->Editor->Colors& Fonts->Android Logcat (set different colors based on log levels)

Essential Tips for Using Android Studio

2. Shortcuts

Common Shortcuts

1. Shrink Selection: A selection shortcut, clicking multiple times will expand the selection range, AS’s iconic shortcut

Mac:Alt+Up/Down

Windows/Linux:Ctrl+W / Ctrl+Shift+W

Essential Tips for Using Android Studio

2. Delete Line: Deletes a line, similar to eclipse’s Ctrl+D, here it is Y

Mac:Cmd+Backspace

Windows/Linux:Ctrl+Y

Essential Tips for Using Android Studio

3. Find Actions: All actions can be found through this function, if you forget a shortcut for a function, you can directly use this function, just enter the function’s name to use, AS’s iconic shortcut.

Mac:Cmd+Shift+A

Windows/Linux:Ctrl+Shift+A

Essential Tips for Using Android Studio

4. Move Lines Up/Down: Move the line where the cursor is located up or down, if multiple lines are selected, they can also be moved together.

Mac:Clt+Shift+Up/Down

Windows/Linux:Alt+Shift+Up/Down

Essential Tips for Using Android Studio

5. Duplicate Lines: Copy the current line to the next line

Mac:Cmd+D

Windows/Linux:Ctrl+D

Essential Tips for Using Android Studio

6. Surround with: Wrap content, very convenient when adding try catch blocks

Mac:Cmd+Alt+T

Windows/Linux:Ctrl+Alt+T

Essential Tips for Using Android Studio

7. Complete Statement: Statement completion, can automatically complete brackets, parentheses, semicolons, etc., and will format the automatically completed line, AS’s commonly used iconic shortcut.

Mac:Cmd+Shift+Enter

Windows/Linux:Ctrl+Shift+Enter

Essential Tips for Using Android Studio

8. Last Edit Location: Return to the last edited location

Mac:Cmd+Shift+BackSpace

Windows/Linux:Ctrl+Shift+BackSpace

Essential Tips for Using Android Studio

9. Difference Between Enter and Tab During Code Suggestions

Essential Tips for Using Android Studio

10. Opening Class/File/Symbol: Shortcut for searching, used to search for class, file, method

1. Open class file

Mac:Cmd+O

Windows/Linux:Ctrl+N

2. Open any file

Mac:Cmd+Shift+O

Windows/Linux:Ctrl+Shift+N

3. Search by method name

Mac:Cmd+Alt+O

Windows/Linux:Alt+Shift+N

11. Show Usage: Find calls, similar to eclipse Ctrl+Alt+G

Mac:Alt+F7

Windows/Linux:Alt+F7

12. Goto Declaration: Jump to the property or method declaration, add Alt to jump to the method implementation

Mac:Cmd+B

Windows/Linux:Ctrl+B

13. Navigate Back/Forward: Jump to the last cursor position

Mac:Cmd+Alt+Left/Right

Windows/Linux:Ctrl+Alt+Left/Right

For more shortcuts, refer to the Default KeyMap Reference in Find Action

Custom Shortcuts

Show in Explorer: Open in system folder

Essential Tips for Using Android Studio

Sync Project with Gradle Files: Sync is required when modifying build scripts, can also be used when recompiling aidl files

Delete to Line End: Delete from cursor to the end of the line

Delete to Line Start: Delete from cursor to the beginning of the line

Analyze Data Flow to Here & Analyze Data Flow from Here: Used to analyze code, those who use it know

Essential Tips for Using Android Studio

Multi-line Editing: A very cool function, Alt + left mouse button selection, better than Sublime’s multi-line editing, but rarely used in actual coding

3. Templates

Improve efficiency, essential skills for home and travel.

1. Live Template

Examples of standard templates

ViewConstructors: One-click generation of constructors when customizing View

Essential Tips for Using Android Studio

starter: One-click generation of startActivity call

Essential Tips for Using Android Studio

For more standard templates, see Preferences->Editor->Live Templates

Essential Tips for Using Android Studio

2. Custom Templates

Standardizing template usage, unifying logging and singleton writing

Singleton template

Essential Tips for Using Android Studio

Log template

Essential Tips for Using Android Studio

3. Postfix Completion

Common examples

Essential Tips for Using Android Studio

For more usage, see Preferences->Editor->General->Postfix Completion

Essential Tips for Using Android Studio

4. Plugins

1. IdeaVim

Vim plugin, can change AS’s editing mode to vim’s editing mode, but the custom functions are not as powerful as normal vim, if you don’t want to leave the mouse, this plugin is a good choice, refer to vim for usage

2. AceJump

This is a plugin for quickly positioning the cursor, with functionality similar to vim’s easyJump plugin. This plugin allows you to get rid of the mouse, the cursor can jump wherever you want.

Essential Tips for Using Android Studio

3. ParcelableGenerator

Used to quickly generate parcelable objects

Essential Tips for Using Android Studio

4. CodeGlance

Displays a thumbnail of the editor in the sidebar, similar to Sublime’s effect, if you are fond of Sublime’s style, you can give it a try

Essential Tips for Using Android Studio

5. Eclipse Code Formatter

Helps AS support Eclipse-style code style configurations, unifying code style Android source code includes a set of code style standard configurations

5. FindBugs-IDEA

A static code defect analysis tool, can be installed with one click in AS plugin management, no configuration required. Supports custom analysis scope, can be used with the scopes settings, can also be used with svn to only analyze the current modification. Convenient and easy to use, recommended!

6. Some Hot Cold Knowledge

1. Scopes & TODO

Scopes function is to set a range, this function is very useful when developing new modules, can unify the code files involved in the new functionality into a new scopes. This makes it easy to use tools like Find-bugs for static code analysis.

Essential Tips for Using Android Studio

The second is to combine with the todo function, which can quickly list the todos marked in the code to prevent omissions.

2. Subversion

AS provides a version control plugin that supports svn and git, needs configuration. When using the svn plugin, you need to enable command line settings during installation, which is not enabled by default. There are many online, so I won’t post specific steps here. Before submitting code using svn, it will first perform a code analysis similar to Find-bugs. If there are defects in the static analysis code, it will not be submitted and will prompt for modification. This is a great feature!

3. Spelling

Is a spell check feature that supports dictionary configuration, default is English. For those who often misspell words, this is a great feature

Essential Tips for Using Android Studio

Essential Tips for Using Android StudioEssential Tips for Using Android Studio

Gad wishes everyone a Happy New Year!

Gad-GameDev∣Tencent Game Developer Platform

Essential Tips for Using Android Studio

Long press, recognize the QR code, and follow

Free component download丨Professional knowledge learning

Team game production丨Project incubation channel

China’s first professional independent game developer platform.

For game practitioners,

Build an open, interconnected, feedback, and sharing professional game community.

Leave a Comment