Android Studio Entry-level tutorials

Source: Internet
Author: User

Quote Original: http://www.cnblogs.com/abao0/p/6934023.html

Blog is to remember that they are easy to forget things, but also a summary of their work, the article can be reproduced, without copyright. Hope to do their own efforts to do better, we work together to improve!

If there is any problem, welcome to discuss together, code if there is a problem, you are welcome to the great God!

As is already a mainstream tool for Android development, but the school is still eclipse, many students do not know how to get started. Online to see a great God organized a very good tutorial, reproduced, hoping to help people in need.

Life One number: http://www.cnblogs.com/smyhvae/

Article Source: http://www.cnblogs.com/smyhvae/p/4390905.html

"Version update for this article"

In 2015-04-03, the first time I wrote this article, the Android studio version of this time was 1.1.

In 2015-05-07, Android Studio was updated to version 1.2, and then the blog post was updated.

In 2016-08-09, Android Studio was updated to version 2.1, and then the blog post was updated.

PS: You don't have to worry about this article being out of date, as this article is updated with the version of Android Studio.

Series

Android Studio Entry-level tutorial (i)

Android Studio Entry-level tutorial (ii): Create a new project that belongs to you and install the Genymotion emulator

Android Studio Entry-level tutorial (iii): Gradle project Build

Objective

Recently the online popular program ape encouragement Teacher's jokes, encourage the teacher's remuneration than the program ape is higher, think also is really a good job, what? You've never heard of it? Turn to the end of this article, exploded view.

Write a blog before: Use Android studio to build the Android integrated development environment (graphics tutorial), the previous one can do a bit of a look. At the time, Andriod studio was still in beta, and now Android Studio has been upgraded to a stable version, deciding to re-write a tutorial that will allow those who are still dying to embrace eclipse (including themselves) to cross the threshold .

"Development Environment"

Physical Machine Version: Win7 flagship edition (64-bit)

Android Studio version: 2.1 Official edition

"The advantages of Android Studio"

      • Build support based on Gradle
      • Android specific refactoring and quick fixes
      • Richer template code, making it easier to create a program
      • Prompt tool for better control of program performance, availability, version compatibility, and other issues
      • Support Proguard and application signature function directly;
      • Comes with a layout editor that lets you drag and drop UI components, preview layouts on multiple screen configurations, and more;
      • Built-in Google Cloud support;
      • Built-in SVN, git tools support;
      • Plug-ins are supported, and Eclipse has one that is basically available in Android Studio.
      • After 2.0, the NDK is supported.

Android Studio Download Green channel: http://www.androiddevtools.cn/

First, Installation:

After the Android studio installation is complete, the first time you start as, to avoid re-downloading the new version of the SDK, you need to do the following:

To open the installation directory before start, add a line to the bin directory's idea.properties file first: disable.android.first.run=true, avoid automatically re-downloading the SDK the first time you open as. The right-click installation package for the Mac platform->show the Contents to find the bin directory.

The first time you open Android Studio, you need to configure the JDK and SDK:

, select "Project Structure" and the following interface appears: (Select the path to the JDK and Android SDK)

Note: Don't ask me how the JDK and Android SDK came from? To install well in advance, this kind of post a lot of search, not my writing style.

Of course, we can also modify the path of the JDK and Android SDK at any time when we are using Android Studio. You can make the same changes by choosing "file-->other settings-->default sructure".

Second, create a new Android Studio project:

Once you've configured your JDK and Android SDK, you're ready to start a new Android project:

, after you have set the project name and path, you can follow it all the way next:

If the user installs Android Studio for the first time, the following window will appear:

, is downloading the latest version of the SDK (API 23), downloaded in a few minutes, because the visit is a foreign site, recommended FQ. Continue to the next step:

, click the "Finish" button and the app is ready to be created.

If the user installs Android Studio for the first time, the following window will appear:

, is in the download Gradle, the file is not big, about a few 10 trillion bar, download up quickly. Since the visit is a foreign site, it is recommended to FQ.

Third, the simple settings of Android Studio:

1. Subject Modification:

Perhaps people will think the software interface is not very good, we can change the theme. Select the menu bar "File--settings--apperance--theme", the theme Select Darcula:

2. Import third-party topics:

The system offers two themes that may not look good, and we can go to the website http://color-themes.com/to get third-party themes, such as the sublime theme that I personally love:

, after downloading it, is a jar package. How do I import it into Android studio?

Don't worry, go back to Android Studio and choose the menu bar "File-import Settings" to import the downloaded jar package.

3, Code font modification:

Select the menu bar "File--settings--editor--colors&fonts--font":

You can also modify the console font:

After the modification, I found that some of the default fonts for the AS, such as the sidebar of the project directory font has not changed, if you want to change it, then change it (I generally do not change), modify as the default font:

4. Close the update:

As shown in the following:

5, shortcut key habits of modification:

If you want to change the usage of the shortcut to eclipse, you can choose the menu bar "File--settings--keymap":

I'm not going to change it here, huh?

6. Add API document hover hint:

As the default is no API document hover prompt, only press and hold "ctrl+q" too will appear prompt. If you want to add an automatic hover hint for the API, set the following:

, in the red box part of the hook on the line, but doing so on the computer's performance consumption will increase, can not be set, according to personal habits.

7, the configuration code automatic prompt: (the new version as default has the Code automatic prompt setting)

The new as default has the function of code auto-completion (old version of As is not), automatic completion of the following settings:

Keep the upper red frame part out of the tick state, you can set the code to auto-completion.

The shortcut keys for code hints are in the following location:

, enter "class name completion" In the search box, see the code hint of the default shortcut is ctrl+alt+ space, if you want to get rid of this shortcut, the operation is as follows:

, right-click the Red-box section and modify it in the pop-up dialog box.

Note: If you are accustomed to using eclipse, but be aware that "alt+/" in Android Studio is another shortcut key:

People who are accustomed to using eclipse can swap the two keys of the Red box section.

To configure the case sensitivity of code hints:

As the default code hints are case-sensitive , do not look at the letter. We enter the lowercase intent, which indicates the following effect:

When you enter the uppercase intent, the prompt effect is as follows: (at this time only the intent class appeared)

As you can see from the above two graphs, the default code hints are case-sensitive . So I want to make as insensitive to case, how do I do it? The operation is as follows:

, we change the part of the arrow to "none". The demo works as follows:

CTRL + Click the mouse to view the source code: (New as has the default setting)

If the SDK has been successfully loaded, this is actually set in the shortcut key:

The shortcut key in the Blue bar box in the section means: Hold down the CTRL key and click the mouse to view the source code.

8, set the Automatic guide package:

Prior to eclipse, we had to guide the package each time we referenced some classes, and as could be set to auto-guide. Settings are as follows:

, check the two locations of the red Ore section.

9. Display the number of lines of code:

, the red frame part is ticked.

10, prohibit automatically open the last project:

I like to choose which project to open, decisively disable (this according to personal preferences ha), set as follows:

11. Prohibit code Folding:

Intellij idea By default there are many places where the code will automatically collapse, but I don't like it, so I canceled, set the following:

12, modify the comment location, disable "statement heap line":

      • Comment at Frist column: If enabled, the position of the note will be at the beginning of the line, otherwise the annotation will be indented. I canceled it.
      • Control statement in one line: When formatting the code, it merges a few short statements into one row. I think this affects the readability of the code, it is canceled.

13. Modify the new file header:

Every time you build a new class, you must be familiar with the following comment.

/*** Created by smyhvae on 2015/5/7.*/

In fact, it is set in the following position:

14, the modified file code for UTF-8:

Android Studio 1.1 is the default encoding method is Utf-8, to the Android Studio 1.2 default encoding method unexpectedly is GBK, to the Android Studio 2.1, the default part encoding method is Utf-8, We still set as UTF-8, do not pit teammates OH:

What the? Do you think that Android Studio is not enough to understand? It doesn't matter, I will continue to fight for the three days of holiday, please look forward to the following. Eye Candy Time to:

Android Studio Entry-level tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.