★안드로이드 스튜디오를 처음 켰을때 뜨는
Android Studio Tips이다.
무시하고 해도되긴하지만 다 도움이 되는 Tips이니 캡쳐해봤다.
★휴대폰 OS 체크법 (▶LINK)
To navigate to the implementations of abstract method,
position the caret at its usage or its name in the declaration and press Ctrl+Alt+B
ctrl+w (=extend selection) in the editor
selects the word at the caret
and then
selects expanding areas of the source code.
For example, it may select a method name,
then the expression that calls this method,
then the whole statement,
then the containing block, etc.
You can also select the word at the caret
and the expanding areas of the source code by double-clicking the target areas in the editor.
The Extract Variable refactoring helps you simplify complicated statements in your code.
For example, in the code fragment below,
you can select an expression in the code:
myEditorPane.setBorder(BorderFactor.createEmptyBorder(5,5,5,5));
and press Ctrl+Alt+v(Refactor | Extract | Variable...).
This will result in the following:
You can comment or uncomment lines and blocks of code using Ctrl+Slash and Ctrl+Shif+slash.
To open your brower with documentation for the element at the editor's caret,
press Shift+F1 (View | External Documentation).
When you need to cast an expression value to the required type
the SmartType code completion will help you.
For example, type
String s = (<caret is here>)
and press Ctrl+Shift+Space to see what happens.
Ctrl+D in the editor duplicates the selected block or the current line
when no block is selected.
Try Live Templates
Live Templates allow you to generate many typical code constructs in seconds!
(코드 자동완성 기능)
The CodeCompletion feature can suggest a name for a variable
when you declare it.
For example, start typing
If the cursor is between the parentheses of a method call,
pressing Ctrl+P brings up a list of valid parameters.
Ctrl+Shift+Backspace (Navigate | Last Edit Location)
brings you back to the last place
when you made changes in the code.
Pressing Ctrl+Shift+Backspace a few times
moves you deeper into your changes history.
Use Ctrl+Shift+F7 (Edit | Find | Highlight Usages in File)
to quickly highlight usages of some variable in the current file.
Use Code | Reformat Code to reformat code according to your code style preferences
(File | Settings | Code Style).
To see your local history of changes in a file,
invoke Local History | Show History from the context menu.
You can navigate through different file versions,
see the differences and roll back to any previous version.
Press Alt+Q
to see the declaration of the current method without the need to scroll to it.
Ctrl+E
brings a popup list of the recently visited files.
Choose the desired file and press Enter to open it.
Use F2/Shift+F2 keys to jump between highlighted syntax errors.
Use Ctrl+J to complete any valid Live Template abbreviation
if you don't remember it.
For example, type it and press Ctrl+J to see what happens.
To show separator lines between methods in the editor,
open the editor settings
and
select the Show method separators check box
in the Appearance page.
When using basic code completion (Ctrl+Space),
type any characters that exist anywhere in an identifier.
Use Alt+Up and Alt+Down keys to quickly move between mothods in the editor.
Ctrl+Shift+J shortcut joins two lines into one
and
moves unnecessary space to match your code style.
Use Refactor | Copy to create a class which is copy of the selected class.
This can be useful, for example,
when you need to create a class which has much in common with some existing class
and it's feasible to put the shared functionality in a common superclass.
Use the Ctrl+Shift+V shortcut to choose and insert recent clipboard contents
into the text.
To see the inheritance hierarchy for a selected class,
press Ctrl+H (Navigate | Type Hierarachy).
You can also invoke the hierarchy view right from the editor
to see the hierarchy
for the currently edited class.
Right-clicking on a breakpoint marker (on the bar to the left from the text)
invokes the speedmenu
where you can quickly enable/disable the breakpoint or adjust its properties.
To easily evaluate the value of any expression
while debugging the program,
select its text in the editor
(you may press a Ctrl+W a few times
to efficiently perform this operation)
and press Alt+F8.
To quickly evaluate the value of any expression
while debugging the program,
hold Alt and click this expression to see its value and calculate it,
call a method, etc.
Use Basic Completion(Ctrl+Space) for completion words in text and comments
in files of many different types.
All the words from the current file that start with the typed prefix will appear in the lookup list.
The shortcut such as Ctrl+Q (View | Quick Documentation),
Ctrl+P (View | Parameter Info),
Ctrl+B (Navigate | Declaration)
and others can be used not only in the editor
but in the code completion popup list as well.
When using code Completion,
you can accept the currently highlighted selection in the popup list
with the period character(.), comma(,), semicolon(;), space and other characters.
The selected name is automatically entered in the editor
followed by the entered character.
To help you learn the purpose of each item in the main menu,
its short description is shown in the status bar
at the bottom of the application frame
when you position the mouse pointer over this item.
For the pattern search in the Go to Class, Go to Symbol and Go to File popup frames,
use * and space symbols.
* stands for any symbol.
Space at the end means the end of a pattern,
When you invoke the Move refactoring (F6) on an inner class that is declared static,
you are provides with the option to either make it a top-level class,
or move it to another class.
You can use the Extract Variable refactoring
even on incomplete statements.
Just press Ctrl+Alt+V,
and choose the desired expression:
To open any particular method or field in the editor quickly,
press Ctrl+Alt+Shift+N (Navigate | Symbol) and start typing its name.
Choose symbol from the drop-down list that appears.
Use Alt+Shift+C to quickly review your recent changes to the project.
Use Basic Completion (Ctrl+Space) within HTML, CSS and other files,
for completing image file names.
You can start refering to an Ant property or target even if it is not defined yet.
An intention action feature with suggest you to automatically create the necessary teg,
without the need for you to leave your current edition location.
With a single keystroke, you can apply another code style/coloring scheme or keymap
right from the editor.
Just press Ctrl+Back Quote (View | Quick Switch Scheme),
to specify the scheme you want to change.
Use Ctrl+Shift+Enter to complete a current statement such as if, do-while, try-catch, return (or a method call) into a syntactically correct construct
(e.g. add curly braces).
When in the Go to class, Go to Symbol, or Go to File popup,
you can ease the search by filtering the lookup list with the help of the "camel words" prefixes.
Use Ctrl+Shift+I (View | Quick Definition), to quickly review definition or content of the symbol at caret, without the need to open it in a new editor tab.
The Edit | Copy Reference action can be used to insert a reference
to a field/method/class/file
into the current position in the editor.
For example, go to the java.util.Collections JDK class,
place the cursor within the EMPTY_MAP field and press Ctrl+Alt+Shift+C:
The Code | Move Statement Up/Down action is useful for reorganizing the code lines
in your file, e.g., for bring a variable declaration closer to variable usage.
Select a code fragment and press Ctrl+Shift+Up or Ctrl+Shift+Down.
The following pictures show an initial location of a code fragment,
and the results of moving the selected fragment up and down.
By pressing Alt+Shift+F10
you can access the Run/Debug dropdown on the main toolbar,
without the need to use your mouse.
The Quick Definition Viewer (Ctrl+Shift+I)
can also be used for items in lookup lists
that appear on code completion
and
class/file/symbol navigation commands.
You can use Basic Completion (Ctrl+Space) within Java String literals
and in other file types, for completing .properties keys.
Navigation bar is a quick alternative to the Project view.
Use Alt+Home keyboard shortcut
to show the navigation bar,
and
arrow keys
to locate the necessary files or folders.
The Version Control tool window shows all deleted, modified, and unversioned files
in a single view.
Use keyboard shortcut
to show or hide this tool window.
From the Changes tool window
you can perform all the necessary version control actions :
commit changes, manage changelists,
put resources under version control,
examine differences and more.
If you notice that Android Studio works slowly,
consider the possibility to reduce the number of folders
under antivirus protection.
Each antivirus check in your project consumes resources.
You can significantly improve the performance,
if you exclude certain folders from the antivirus protection.
If you don't want to commit some of your changes to the repository,
you can set them aside for while, by moving to a separate changelist,
or by putting them to a shelf.
Select such file in the Local tab of the Changes tool window,
and on the context menu choose Move to Another Changelist, or Shelve Changes.
You can bring forward the list of all usage of a class,
method or variable across the whole project,
and quickly jump to the selected usage.
To do that, place the caret at the symbol's name
ot
at its usage in code
and
press Ctrl+Alt+F7 (Edit | Find | Show Usages in the main menu),
scroll the list and click the desired usage.
To quickly find a menu command or toolbar action,
you do not need to look through the menus.
Just press Ctrl+Shift+A
and start typing the name of the action.
Choose the desired action from the suggestion list.
To quickly find and run an inspection,
press Ctrl+Alt+Shift+I
and start typing the name of the inspection
or its group.
Choose the desired inspection from the suggestion list
and then
specify the desired scope.
You can quickly find a setting you need
in the Settings/Preferences dialog,
without browsing through the numerous options.
Just type some characters that, in your opinion,
exist in the option description, and the list of settings will reduce to the matching ones.
Select the desired entry, and see the setting that contains the entered characters highlighted:
You can create code constructs using statement completion.
Start typing a method declaration or statement,
and press Ctrl+Shift+Enter
after the opening parenthesis.
The braces are created, with the caret placed inside:
You can view all methods of the implemented interfaces in a class,
if you place the caret at the implements keyword in the class declaration,
press Ctrl+Shift+F7,
and select the desired interface from the list :
When searching for a text string in a file,
use recent history :
with the search pane already open,
click the down arrow to show the list of recent entries.
You can view all statements within the method where certain exceptions can be caught.
Just place the caret at the throws keyword in a method declaration,
press Ctrl+Shift+F7
and select the desired exception class from the list.
This will also work for try and catch.
When you press Alt+Enter to invoke a quick fix or intention action,
press the right arrow key to reveal the list of additional options.
Depending on the context, you can choose to disable inspection,
fix all problems, change inspection profile, etc.
You can drag an external file from the Explorer or Finder,
and drop it onto the Favorites tool window.
Tune the Android Studio tool windows layout
to make better use of your screen.
Toggle between the vertical and side-by-side placement of the tool windows by Ctrl+Click/Cmd+Click on the splitter :
You don't need to leave Android Studio
to work with your favorite shell.
Just click the Terminal tool window button,
and enjoy using the embedded local terminal.
For the embedded local terminal,
you can define your favorite shell,
default tab name,
and other settings.
Choose File | Settings on the main menu, and then open the page Terminal.
Enable the horizontal scrolling with the mouse wheel by holding the Shift key.
Android Studio allows you to search through the classes, files, tool windows,
actions, settings, and symbols of your project
by double pressing the Shift key.
When using autopopup Code Completion,
you can select the first item using Ctrl+Period.
The selected name is automatically entered in the editor followed by dot.
When an autopopup completion is active,
Ctrl+Down and Ctrl+Up will close it and move the caret down or up in the editor.
When in the Code Completion lookup,
you can ease the search by filtering the list with the help of the "camel words" prefixes.
Pressing the same shortcut after you have invoked Smart-type Completion
when there's an array of expected type in context will suggest to get an element
from this array.
Pressing the same shortcut after you have invoked Smart-type Completion
when a collection type is expected will search for arrays with same component type and suggest to convert them using Arrays.asList() call.
Pressing the same shortcut after you have invoked Smart-type Completion
will search for chained expressions which have expected type.
When using Code Completion,
you can accept the currently highlighted selection in the popup list with the Ctrl+Shift+Enter,
Android Studio will not just insert the selected string,
but also will do its best to turn current code construct into syntactically correct one
(balance parentheses, add missing braces and semicolons, etc)
When using Code Completion in Java,
you can accept the currently highlighted selection in the popup list with the exclamation sign (!) character.
It will be inserted before the boolean method or variable you were completing,
thus negating the whole expression.
To quickly complete a method call of static method located anywhere in your project, libraries or JDK,
enter a prefix and press Ctrl+Space twice.
You'll see all the matching methods.
If you want the method you chose to be imported statically,
press Alt+Enter and see what happens.