Android Studio using tutorials and graphics

Source: Internet
Author: User

The Android Studio 1.0 Official Edition is finally released! Google says Android Studio 1.0 makes developers "faster and more productive" and thinks it can replace Eclipse and provide migration steps for Eclipse users. Code automatic prompts, running response speed, are better than eclipse. Let's take a look at the use of Android studio and some of the feelings I used in these two days, first of all, I tried it on a Mac, I heard that in Windows comparison cotton and memory consumption, on Linux and Mac on the use should be good.

First, download the installation

To http://developer.android.com/sdk/installing/studio.html Download the installation package (DMG file), open and drag the Android studio to the applications, copy it , you can drag the icon to the dock under the application.

Second, new project

When the installation is complete, select the default option and click OK:

Into Android Studio, the start interface is a bit like Xcode, click New Project to create a new project, and the new process is almost as much on eclipse as it is here. The following figure is the start interface:

After the new project is completed, it enters the Android studio main interface. The first time to go in may be shown in the following figure nothing, click the arrow button to expand the directory structure,

When you start to see the directory structure of the Android studio, there's a little difference between the projects in eclipse:

Difference:

1.Android Studio's directory structure originally represents a workspace, a workspace can have a module, you can interpret a module as a project in eclipse;

2. The directory of Java Code and resource files (Pictures, layout files, etc.) all boil down to SRC, in the SRC directory has a main group, while dividing the Java and res two group,res and eclipse under the structure, Java is the source of the package and class files;

3. New file methods, the right key to choose New or Command+n after the new menu, type has Java class, that is, General Java classes, file is ordinary files, package is to build a package, it is worth noting that the Android Component, It directly provides the creation of basic components in Android.

You can choose to create different types of components in Android:

Three, the window layout and the topic introduction

In addition, there is a tab at the bottom of the main interface called Android that opens to see device information and Logcat output in DDMS:

The top toolbar can see an option like the one in eclipse, which I believe we all know better:

The last thing to say is that you see my main interface is dark style, and Google demo is the same style, the first time you use the default style (color), if you want to change, enter preferences (press command+,) to the IDE Settings to select Colors&font and set schema name to Darcula can be set to a dark style, if you need to define your own style, such as font size and color, you can create a new schema to define your own

Iv. Layout Document preparation (Live preview)

The most dazzling features to come, real time to write and preview the layout file, this feature really greatly improve the development efficiency, open an XML layout file click on the right preview tab to call out the preview interface, you can choose many sizes of mobile phone to preview:

At the same time, can also preview a variety of different models and sizes of the equipment, code at the same time suitable for a variety of models, this is not the original dream of it!

It describes the basics of Android studio, including installation, new projects, engineering structures, and theme settings. Here are some other tips, as well as some of the comparisons before eclipse. To reiterate, all my operations and versions are based on the MAC system, the students in Windows are basically similar, the following is a topic to start it:

First, import engineering from Eclipse to Android Studio

According to the official introduction, Android Studio can be compatible with Eclipse's existing engineering, but needs to do something:

First upgrade ADT to the latest version, currently version number 22 (note and ADT related components best to upgrade together to avoid later possible errors)

Select the project you want to export from eclipse, right-click the export and select Generate Gradle build Files under Android (pictured below):

After the selection is not exported to other places, instead, it generates a Build.gradle file in the local project, as you can see in the Eclipse project, which is identified by the Android studio, as shown in the following illustration:

3. Then enter the Android studio and select Import Project to see that the project icon just in Eclipse has become an Android robot icon, indicating that the conversion was successful, when the project import can be selected:

Now that you've finished importing your existing Android project from Eclipse to Android Studio, you're ready to start working on the project!

Ii. the difference between Eclipse Engineering and Android Studio

Eclipse Engineering can be imported into the Android studio, while the project built on Android Studio will not work in eclipse;

The engineering structure of the two is different, and in Eclipse, a project represents an item project, and in Android studio, like IntelliJ, a project represents a workspace, equivalent to the workspace in Eclipse, And in Android Studio, a module is equivalent to a project in Eclipse, and the concept needs to be understood, not to confuse or get confused.

In an edit operation, you must manually command+s the file after editing the modification in eclipse, and it is automatically saved in Android studio like IntelliJ, which is similar to the 2nd and Xcode.

The difference in the engineering directory is that the SRC section in eclipse is typically a Java file, and the Res section is a resource file, including layout files and multimedia resources. In Android Studio, you can look at the directory structure of the following figure:

including Java files and resource files are all placed in the SRC directory, the SRC directory includes a main folder, and then the following is the Java folder and Res folder, in fact, here, Java folder is equivalent to Src,res in eclipse or that res, Here I think of the mountains teacher's sketch "Src is not that SRC, res or that res"

Third, the real machine operation as well as the common shortcut key

Click on the Android tab in Android Studio to see device information and Logcat, when you connect to the device and open the Android tab to detect the real machine, it will be displayed in the device, and you can start the project by clicking on the green small arrow at the top. One thing to note is that the runtime can choose the emulator or the real machine, because there is a device priority selection when running the project in Android Studio, and if not set, there may be a phenomenon that runs only on the emulator, We can set our own: first click on the Run menu to choose Run Configuration, and select the target device you want to select, can be simulator and real machine, can also be selected by the user to select:

Shortcut key you can be familiar with the official documents, such as the following table, you can modify the configuration options for customization:

Personally think Android studio still has a certain prospect, here needs Google to continue to improve and improve, and quickly to save everyone from Eclipse. In addition, in the meantime, you can actually try to use IntelliJ idea, this is the default is the integration of the Android development environment. Android Studio is based on the former, which is similar in usage and a good substitute for eclipse. A Windows version of Android Studio download is available below.

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.