Tips
- Navigate menu
- In case you’re not familiar with an API class, file or symbol, the Navigate menu lets you jump directly to the class of a method or field name without having to search through individual classes.
- Inspection scopes
- Scopes set the color of code segments for easy code identification and location. For example, you can set a scope to identify all code related to a specific action bar.
- External annotations
- Specify annotations within the code or from an external annotation file. The Android Studio IDE keeps track of the restrictions and validates compliance, for example setting the data type of a string as not null.
- Injecting languages
- With language injection, the Android Studio IDE allows you to work with islands of different languages embedded in the source code. This extends the syntax, error highlighting and coding assistance to the embedded language. This can be especially useful for checking regular expression values inline, and validating XML and SQL statments.
- Code folding
- This allows you to selectively hide and display sections of the code for readability. For example, resource expressions or code for a nested class can be folded or hidden in to one line to make the outer class structure easier to read. The inner clas can be later expanded for updates.
- Image and color preview
- When referencing images and icons in your code, a preview of the image or icon appears (in actual size at different densities) in the code margin to help you verify the image or icon reference. Pressing F1 with the preview image or icon selected displays resource asset details, such as the dp settings.
- Quick F1 documentation
- You can now inspect theme attributes using View > Quick Documentation (F1), see the theme inheritance hierarchy, and resolve values for the various attributes.
If you invoke View > Quick Documentation (usually bound to F1) on the theme attribute ?android:textAppearanceLarge, you will see the theme inheritance hierarchy and resolved values for the various attributes that are pulled in.
The Hot-Keys mapping
- Alt + Enter key binding
- For quick fixes to coding errors, the IntelliJ powered IDE implements the Alt + Enter key binding to fix errors (missing imports, variable assignments, missing references, etc) when possible, and if not, suggest the most probable solution.
- Ctrl + D key binding
- The Ctrl + D key binding is great for quickly duplicating code lines or fragments. Simply select the desired line or fragment and enter this key binding.
Action | Hot-Key | @Mac |
---|---|---|
Command look-up (autocomplete command name) | CTRL + SHIFT + A | |
Project quick fix | ALT + ENTER | |
Reformat code | CTRL + ALT + L | OPTION + CMD + L |
Show docs for selected API | CTRL + Q | F1 |
Show parameters for selected method | CTRL + P | |
Generate method | ALT + Insert | CMD + N |
Jump to source | F4 | CMD + down-arrow |
Delete line | CTRL + Y | CMD + Backspace |
Search by symbol name | CTRL + ALT + SHIFT + N | OPTION + CMD + O |
Build | CTRL + F9 | CMD + F9 |
Build and run | SHIFT + F10 | CTRL + R |
Toggle project visibility | ALT + 1 | CMD + 1 |
Navigate open tabs | ALT + left-arrow ALT + right-arrow |
CTRL + left-arrow CTRL + right-arrow |
TO BE CONTINUED …