The original intention of writing this article is to list useful tips, tricks, shortcuts, and reference resources for Android Studio that will improve your overall efficiency and performance. Obviously, there are many more optimizations, shortcuts, etc., but I kept this post short and limited it to 49. I hope you enjoy this post! Note: This article uses MacOS X to operate Android Studio as an example. The inconsistencies with Windows / Linux have been marked. Please pay attention to this. Visualization 1.Material Colors theme for Android Logcat. To change the Android Studio Logcat, you need to go to: Preferences → Editor → Colors & Fonts → Android Logcat, and then change the foreground color for each type of log. (Note that Perferences here is Settings on Windows/Linux.) My material colors are as follows:
2. To prevent Android Studio Logcat from crashing, the log of the current application should be cleared. To do this, you need to go to the Android Monitor panel and select Edit filter configuration from the drop-down list on the right. 3. Apply the correct code style to your IDE (IntelliJ / Android Studio). Click Preferences → Code Style → Java and select your code style in the Scheme drop-down list (or set a new one). There are 2 styles worth mentioning:
You can import the theme as shown in the gif below: The picture is too large to be displayed, please click "Read original text" to view~~ 4. Use split screen to improve efficiency. To turn this feature on, you need to right-click on the tab on the Home screen and select Split Vertically/Horizontally. But to be as efficient as possible, we need to set a custom keyboard shortcut. To do this, go to Preferences → Keymap and find Split Vertically. Then open the context menu and click Add Keyboard Shortcut. In my case, for vertical split view, I added control + alt + v. As shown in the gif below. You can define shortcuts for horizontal split view as well. 5. Distraction Free Mode You can turn on distraction free mode by clicking View → Enter Distraction Free Mode. In distraction-free mode, the editor occupies the entire IntelliJ IDEA frame without any editor tabs and tool buttons, and the code is aligned in the center. [IntelliJ Idea View Mode] 6. Use live templates You can use the shortcut: cmd+j (Windows/Linux: ctrl+j). You can use many defined templates, like Toasts or if conditions. You can use your own custom template. Here is a reference article by Reto Meier. You can also refer to the IntelliJ IDEA documentation. Shortcuts and Useful Commands 1. The most common and useful command is Search for command: cmd + shift + a (Windows / Linux: ctrl + shift + a). When you want to close the current tab and don’t know how to do it, you can just type: close and you will get a correct shortcut/command. 2. Select from Recent Copy/Paste (Manage Clipboard): cmd + shift + v (Windows/Linux: ctrl + shift + v). By default, there are 5 copy/paste items. The depth of the clipboard stack is configured in the Limits section of the Editor page of the Settings dialog box. When the specified number is exceeded, the oldest entries are removed from the list. [Cut, copy, and paste in IntelliJ IDEA] 3. Enable the multi-cursor feature: control + g (Windows/Linux: alt + j). A detailed article about this feature is provided by Bartek Lipinski on Medium. Highly recommended! 4.Open a class: cmd + o (Windows/Linux: ctrl + n). 5.Open any file: cmd + shift + o (Windows/Linux: ctrl + shift + n). 6.Open symbol: cmd + option + o (Windows/Linux: alt + shift + n). 7.Go to implementation: cmd + option + b (Windows/Linux: ctrl + alt + b). Assuming you have an interface, by clicking on the name of the interface and then clicking on the Go to implementation shortcut, you will be redirected to the class that implements the interface. 8.Go to declaration: cmd + b (Windows/Linux: ctrl + b). It allows you to quickly inspect and go to the declaration of a class, method or variable. 9.Go to type declaration: control + shift + b (Windows/Linux: ctrl + shift + b). Suppose you define: Employee employee = new Employee("Michal"); When your caret is on employee and you click the shortcut, you will be redirected to the Employee class. 10.Go to super: cmd + u (Windows/Linux: ctrl + u). For example, you override some method. When you place the caret at the method name and click Go to super shortcut, you will be redirected to the parent method. 11.Move between tabs: cmd + shift + [ or cmd + shift + ] (Windows/Linux: alt + ← / →). 12.Move between Design / Text tabs in layout's view: control + shift + ← / → (Windows / Linux: alt + shift + ← / →). 13.Close a current tab: cmd + w (Windows/Linux: ctrl + shift + a). 14.Hide all windows: cmd + shift + F12 (Windows/Linux: ctrl + shift + F12). 15.Minimize Android Studio instance: cmd + m (Windows/Linux: ctrl + m). 16.Format your code: cmd + option + l (Windows/Linux: ctrl + alt + l). 17.Auto-indent lines: control + option + i (Windows/Linux: ctrl + alt + i). 18.Implement methods: control + i (Windows/Linux: ctrl + i). Suppose you implement an interface, then you can quickly import all the methods provided by the interface by just clicking this shortcut. 19.Smart code completion (filter the list of methods and variables by expected type): control + shift + space (Windows/Linux: ctrl + shift + space). 20.Find: cmd + f (Windows/Linux: ctrl + f). 21.Find and replace: cmd + r (Windows/Linux: ctrl + r). 22.Move hardcoded strings to resources: option + return (Windows/Linux: alt + enter). When using the caret on text, you must use the shortcut. If you use this shortcut globally, the IDE will perform a Project quick fix (showing the intention action and the quick fix). 23.Build and run: control + r (Windows/Linux: shift + F10). Plugins
resource
|
<<: The ninth episode of the Aiti Tribe Clinic: Java, Python, PHP, they all say they are simple
>>: AR/VR experts tell you: What will the future of human-computer interaction look like?
Why do we say that the online celebrity purchasin...
On January 26, the third-party research organizat...
For operational promotion, the most important thi...
During the Spring Festival, we planned a red enve...
What is the display advertising system? Display a...
Brand self-broadcasting or store broadcasting is ...
[[124508]] The American technology blog Re/code w...
《Cotton Swab Medical Science Popularization》 Song...
1. The application value of genetic testing in me...
Apple is working on a series of new programs to h...
The Mobile World Congress MWC2017, which just conc...
Growth is like a sword of Damocles hanging over t...
Google announced the new version of Android 12 mo...
What I want to talk about today is search OCPC. I...