Android Studio entry-level tutorial (1), androidstudio

Source: Internet
Author: User

Android Studio entry-level tutorial (1), androidstudio
Statement

AS is a mainstream tool for Android development, but eclipse is used for school teaching. Many people do not know how to get started. I can see a very well-organized tutorial on the Internet. I will repost it and hope it can help people who need it.

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

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

 

[Version updates in this article]

 

The first time I wrote this article on, the Android Studio version was 1.1.

 

In, Android Studio was updated to version 1.2, and the blog post was also updated.

 

Android Studio is updated to version 2.1, and the blog post is updated accordingly.

 

PS: You don't have to worry that this article will be outdated, because this article will be updated as Android Studio is updated.

 

 

[Series]

Android Studio entry-level tutorial (1)

Android Studio entry-level tutorial (II): Create a new project and install the Genymotion Simulator

Android Studio entry-level tutorial (III): gradle Project Construction

 

Preface

Recently, programmers have become popular on the Internet to encourage teachers. The rewards for teachers are higher than those for programmers. I think it is indeed a good job. What? You have never heard of it? Go to the end of this article to make a burst.

I wrote a blog: I used Android Studio to build an Android integrated development environment (Graphic tutorial). I can take a look at the previous article. At that time, Andriod Studio was still in the beta version. Now Android Studio has been upgraded to the stable version. I decided to re-write the tutorial article,Let those who are still holding eclipse (including themselves) across this hurdle.

 

[Development Environment]

Physical server version: Win7 flagship edition (64-bit)

Android Studio version: official version 2.1

 

[Advantages of Android Studio]

    • Gradle-based construction support
    • Specific Android reconstruction and quick fix
    • Richer template code makes it easier to create a program
    • Prompt tools to better control and capture program performance, availability, version compatibility, and other issues
    • Support ProGuard and application signature functions directly;
    • The built-in layout editor allows you to drag and drop the UI component and preview the layout on multiple screen configurations;
    • Built-in support for Google cloud;
    • Built-in support for svn and git tools;
    • Supports plug-ins, which are available in eclipse and can be found in Android Studio.
    • After 2.0, NDK is supported.

Android Studio download the green channel: http://www.androiddevtools.cn/

 

1. First installation:

After Android Studio is installedAvoid downloading the new SDK, You need to do the following:

Before starting AS, open the installation directory. add a row in the properties file: disable. android. first. run = true to avoid automatically re-downloading the SDK when the AS is enabled for the first time. Right-click the installation Package on the mac platform and choose Show Package Contents to find the bin directory.

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

Select "Project Structure". The following page is displayed: (select the JDK and Android SDK paths)

Note: Do not ask me how the JDK and Android SDK come from? You need to install it on your own in advance. This kind of post is not my writing style.

Of course, when using Android Studio, you can modify the JDK and Android SDK paths at any time. Select File> Other Settings> Default Sructure to make the same changes.

 

 

 

2. Create an Android Studio project:

After configuring JDK and Android SDK, you can start creating an Android project:

After you have set the project name and path, you can click next:

If you install Android Studio for the first time, the following window appears:

 

Download the latest SDK (API 23) in a few minutes. We recommend that you use FQ to access a foreign website. Next step:

Click "finish" to create the application.

If you install Android Studio for the first time, the following window appears:

In, It is downloading Gradle, the file is not large, it may be dozens of megabytes, download very quickly. Because you are visiting a foreign website, we recommend that you use FQ.

 

3. Simple settings of Android Studio:

1. Modify the topic:

You may think that the software interface is not very nice. We can change the topic. Select "File -- settings -- apperance -- theme" on the menu bar, and select Darcula as the topic:

 

2. Import a third-party topic:

The two themes provided by the system may not look very good. We can go to the website http://color-themes.com/to get the third-party theme, which is better than sublimetheme:

 

Is a jar package. How can I import data to Android Studio?

Don't worry. Go back to Android Studio and select "File-Import Settings" on the menu bar to Import the downloaded jar package.

 

3. Code font modification:

Select "File -- settings -- Editor -- Colors & Fonts -- Font" in the menu bar ":

You can also modify the font of the console:

After modification, we found that some of the default fonts of AS, such AS the fonts of the project directory on the sidebar, have not changed. If you want to change the fonts, modify the default font of:

 

 4. Disable update:

As shown in:

5. Modify the shortcut key habits:

If you want to change to the Eclipse shortcut style, you can select "file -- Settings -- Keymap" on the menu bar ":

I won't change it here.

 

6. the following message is displayed when an api document is added:

By default, AS does not have the api documentation floating prompt. The prompt is displayed only when you press Ctrl + Q. If you want to add an api's Automatic Floating prompt, set it as follows:

, In the red box part of the hook on the line, but this will increase the performance consumption of the computer, you can not set, according to personal habits.

 

7. Automatic prompt for configuration code: (the new version of AS has the settings for automatic prompt of code by default)

The new version of AS has the code auto-completion function by default (the old version of AS does not have). The auto-completion settings are AS follows:

Keep the red box above to check the status, and you can set it to automatically complete the code.

 

The shortcut key prompted by the code is in the following position:

In the search box, enter "class name completion" and you will see that the default shortcut key prompted by the Code is Ctrl + Alt + space. If you want to change this shortcut key, the operation is as follows:

In the left-side Navigation Pane, right-click the red box and modify it in the displayed dialog box.

Note: If you are used to using Eclipse, note that [Alt +/] In android Studio is another shortcut key:

Users who are used to using Eclipse can exchange the two shortcut keys in the red box.

 

Configure the case sensitivity of code prompts:

The default code prompt for AS is:Case SensitiveDon't believe it. Enter a lower-case intent, and the prompt is as follows:

When an upper-case Intent is input, the following message is displayed: (Intent class appears at this time)

The above two figures show that the AS default code prompt isCase Sensitive. What should I do if I want to make the AS case insensitive? The procedure is as follows:

. The demo is as follows:

 

 

Hold down the Ctrl key and click the mouse to view the source code: (the new version AS already has this setting by default)

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

The shortcut key in the blue box means: press Ctrl and click the mouse to view the source code.

 

8. Set the automatic import package:

Previously in Eclipse, we had to export packages every time we referenced some classes, and AS can be set to automatically export packages. The settings are as follows:

.

 

9. display the number of lines of code:

.

 

10. Disable Automatic Opening of the previous project:

I like to select which project to open and disable it (based on my preferences). The settings are as follows:

 

11. disable code folding:

Intellij IDEA automatically folds code in many places by default, but I am not familiar with it, so I canceled it and set it as follows:

 

12. Modify the comment location and disable "Statement heap line ":

    • Comment at frist column: If it is enabled, the Comment position will be at the beginning of the line; otherwise, the Comment will be based on indentation. I canceled it.
    • Control statement in one line: When formatting the Code, some very short statements are merged into one line. I think this affects code readability, so it is canceled.

 

13. Modify the new file header:

Every time you create a new class, you must be familiar with the following comments?

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

 

In fact, it is set at the following position:

 

14. Modify file encoding to UTF-8:

Android Studio 1.1 uses UTF-8 by default. Android Studio 1.2 uses GBK by default. Android Studio 2.1 uses UTF-8 by default, we still set as a unified UTF-8, do not pit teammates Oh:

 

 

What? Do you think you do not know enough about Android Studio? It doesn't matter. I will continue to fight for the three days of the holiday. Please wait for the following. Eye maintenance time:

Related Article

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.