Friday, 4 September 2015

Android Studio Tips and Tricks (Shortcut keys for easy access)

This year end the Eclipse support for Android Development is going to end. So, here are Some tips and tricks useful for Android Studio...


Customizing Android Studio with Themes:

You can download themes from http://www.ideacolorthemes.org/themes/ and customize the intelliij themes...


Programming key commands

Command look-up (Autocomplete command name) 
  •  CTRL + SHIFT + A 

Project quick fix 
  • ALT + ENTER  

Reformat code
  • CTRL + ALT + L (Win)
  • OPTION + CMD + L (Mac)

Show docs for selected API 
  • CTRL + Q (Win)
  • F1 (Mac)

Show parameters for selected method 
  • CTRL + P

Generate method 
  • ALT + Insert (Win)
  • CMD + N (Mac)

Jump to source 
  • F4 (Win)
  • CMD + down-arrow (Mac)

Delete line 
  • CTRL + Y (Win)
  • CMD + Backspace (Mac)

Search by symbol name 
  • CTRL + ALT + SHIFT + N (Win)
  • OPTION + CMD + O (Mac)
Project and editor key commands

Build 
  • CTRL + F9 (Win)
  • CMD + F9 (Mac)

Build and run 

  • SHIFT + F10 (Win)
  • CTRL + R (Mac)

Toggle project visibility 

  • ALT + 1 (Win)
  • CMD + 1 (Mac)

Navigate open tabs 

  • ALT + left-arrow; ALT + right-arrow (Win)
  • CTRL + left-arrow; CTRL + right-arrow (Mac)

Open Class File Symbol
Open class

  • CTRL+N(win)
  • CMD+O(mac)

Open file

  • CTRL+SHIFT+n(win)
  • CMD+SHIFT+o (mac)

Open Symbol

  • CTRL+SHIFT+ALT+N
  • CMD+ALT+O

Recent Files Opened

  • CTRL+E(win)
  • CMD+E(mac)

Recently edited files

  • CTRL+SHIFT+E(win)
  • CMD+SHIFT+E(mac)

Previous Next/Previous Error

  • SHIFT-F2/F2(win)

Last edited Location

  • CTRL+SHIFT+backspace(win)
  • CMD+SHIFT+backspace(mac)

Go to Declaration
  • CTRL+B(win)
  • CMD+B(mac)
Go to Super
  • CTRL+U(win)
  • CMD+Y(mac)

Creating New Files in Project Folder....

You can quickly add new code and resource files by clicking the appropriate directory in the Project pane and pressingALT + INSERT on Windows and Linux or COMMAND + N on Mac. Based on the type of directory selected, Android Studio offers to create the appropriate file type.
For example, if you select a layout directory, press ALT + INSERT on Windows, and select Layout resource file, a dialog opens so you can name the file (you can exclude the .xml suffix) and choose a root view element. The editor then switches to the layout design editor so you can begin designing your layout.

Creating layouts

Android Studio offers an advanced layout editor that allows you to drag-and-drop widgets into your layout and preview your layout while editing the XML.
While editing in the Text view, you can preview the layout on devices by opening the Preview pane available on the right side of the window. Within the Preview pane, you can modify the preview by changing various options at the top of the pane, including the preview device, layout theme, platform version and more. To preview the layout on multiple devices simultaneously, select Preview All Screen Sizes from the device drop-down.

Display line numbers for the code:

One of the most commonly used feature in Eclipse is the display of line numbers which can also be enabled in Android studio. You can enable them by going to File>Settings> Editor> Appearance and check-marking Show line numbers option.

No comments:

Post a Comment