Introduction to android studio usage and catalog

Basic usage introduction

1. Set the shortcut key —In the settings window, find IDE Settings->keymap, and the shortcut key is opened on the right. Right-click the shortcut key you want to modify, a menu will pop up, select "Add keyboard shortcut" to modify the shortcut key. To delete, select remove XXX in the pop-up menu.

Features Android Studio shortcut keys
Quick fix Alt + Enter
Delete the line where the cursor is (selected line) Ctrl + Y / Ctrl + X
Copy the line where the cursor is (selected line) Ctrl + D
Format code (java, xml) Ctrl + Alt + L
Create local variables quickly Ctrl + Alt + V
Local variables become member variables Ctrl + Alt + F
Move the selected line up and down Ctrl + Shift + Up / Down
Rename Shift + F6
Method parameter prompt Ctrl + P
Printout salt
Quickly locate any file Press shift twice
Quickly locate a certain class or file Ctrl + N: find class
Ctrl + Shift + N Find files
Quickly locate methods or attributes in the class Ctrl + F12
Where is the quick location method called Ctrl + Alt + H
Quickly locate the error or warning of the current class F2 或Shift+F2
Quickly locate the definition of a class or method Ctrl+B
Code assistant, automatic completion Ctrl + Alt + space: prompt for attribute name, class name or interface name
Ctrl + Shift + space Method hint
Import package Alt+Enter Import the current package
Ctrl + Alt + O Delete unused packages.
Set automatic package guide check Add unambiguous imports on the fly
Search or replace Ctrl + F / Ctrl + R
Global search or global replace Ctrl + Shift + F Search in the selected file directory
Ctrl + Shift + R Replace in the selected file directory
Select a variable to quickly jump to the next Alt + F3, F3
The previous or next position of the cursor Ctrl + Alt + Left / Right
Display JavaDoc (comment document) Ctrl + Q
Import overloaded methods Ctrl + O input method name up and down arrow keys to select and press Enter
Generate get/set method, construction method, toString() alt + insert
Quick view of class inheritance structure Ctrl + H
Revoke Ctrl+Z
restore Ctrl+Shift+Z
Comment Same as on the left
Carriage return Ctrl + Alt + Enter
Copy the global path of the class (package name plus class name) Ctrl + Shift + Alt + C (right click --> Copy Reference)
Uppercase lowercase Ctrl + Shift + U
Back to the last edited position Ctrl + Shift + Backspace
View display and hide Alt + number
Show class structure window (Outline) Alt + 7

2. Modify the theme —In IDE Settings->Appearance, select your favorite theme in the Theme on the right. I personally like the Darcula theme, which is the screenshot style above.
在这里插入图片描述
3. How to import the Eclipse project into AS for use — select File->Import Project, select the project to be imported in the pop-up menu, and then directly next after selecting it, and select the default first in the second window Just one option. It should be noted that in AS, there are two types of projects, one is Project and the other is Module, which has been discussed in detail above.

4. Import the jar package —Select File->Projcet Structure, find and select Libraries on the left side of the pop-up window, then click "+", and select Java to import the Jar package. Or directly copy the jar file to the libs folder of the project, and then run: Sync Project with Gradle Files. Then recompile the clean project.

在这里插入图片描述

1…gradle 和 .idea

这两个目录下放置的都是andriod studio 自动生成的一些文件,我们无需关心,也不去手动编辑。

2.app

项目中的代码、资源等内容几乎都是放置在这个目录下的。

3.build

这个目录页不需要过多的关心,他主要是包含了一些在编译时自动生成的文件

4.gradle

这个目录下包含了gradle wrapper的配置文件,使用gradle wrapper的方式不需要提前将gradle下载好,而是会自动根据本地的缓存情况决定是否需要联网下载gradle。andriod studio默认没有启用gradle wrapper的方式,如果需要打开,可以点击andiod studio导航栏–file–Setting–Build,Execution,Deployment
–Gradle,进行配置更改。

5.gitignore

这个文件是用来将指定的目录或文件排除在版本控制之外的。

build.gradle

这个项目全局的gradle构建脚本,通常这个文件中的内容是不需要修改的。

7.gradle.properties

这个文件是全局的gradle配置文件,在这里配置的属性将会影响到项目中所有的gradle编译脚本。

8.gradlewhe和gradlew.bat

这两个文件是用来在命令行界面中执行gradle命令的,其中gradlew实在Linux或Mac系统中使用的,gradlew.bat实在Windows系统中使用的。

9.first_demo.iml

iml文件是所有Intellij IDEA项目都会自动生成的一个文件(Andiod Studio是基于IntelliJ IDEA开发的),用于标识这是一个IntelliJ IDEA项目,我们不需要修改这个文件中的任何内容。

10.local.properties

这个文件用于指定本机中的AndiodSDK路径,通常内容都是自动生成的,我们并不需要修改。
除非你本机中的AndiodSDK位置发生了变化,那么就将这个文件中的路径改成新的位置即可。

11.settings.gradle

这个文件用于指定项目中多有引入的模块。由于HELLO World项目中就只有一个app模块,因此该文件中也就只引入了app这一个模块,通常情况下模块的引入都是自动完成的,需要我们手动去修改这个文件的场景可能比较少。
看完就知道重点在app目录。大多数文件都是自动生成的。
下面对app目录下的内容进行详细的分析

1.build

这个目录和外层的build目录类似,主要是包含了一些在编译时自动生成的文件,不过它里面的内容会更多更杂,我们不需要过多关心。

2.libs

如果你的项目中使用到了第三方的jar包,就需要把这些jar包都放在libs目录下,放在这个目录下的jar包都会被自动添加到构建路径里去。

3.andriodTest

此处是用来编写Andiod Test测试用例的,可以对项目进行一些自动化测试。

4.Main–>java

毫无疑问,java目录是防止我们所有java代码的地方,展开目录,你将看到我们刚才创建的firstdemoActicity文件就在里面。

5.res

这个目录下的内容很多。简单地说,就是你在项目中使用到的所有图片、布局、字符串等资源都需要放在这个目录下。当然这个目录下还有很多子目录,图片放在drawable目录下,布局放在layout目录下,字符串放在values目录下,所以你不用担心会把整个res目录弄得很乱。

6.AndiodManifest.xml

这是你整个Andriod项目的配置文件,你在程序中定义的所有四大组件都需要在这个文件注册,另外还可以在这个文件中给应用程序添加权限声明。

7.test

此处是用来编写UnitTest测试用例的,是对项目进行自动化测试的另一种方式。

8.gitignore

这个文件用于将app模块内的指定的目录或文件排除在版本控制之外,作用和外层的.gitignore文件类似。

9.app.iml

IntelliJ IDEA项目自动生成的文件,我们不需要关心或修改这个文件中的内容

10.build.gradle

这是app模块的gradle构建脚本,这个文件中会指定很多项目构建相关的配置,我们稍后会详细分析gradle构建脚本中的具体内容。

11.proguard-rules.pro

这个文件用于指定项目代码的混淆规则,当代吗开发完成后打成安装包文件,如果不希望代码被别人破解,通常会将代码进行混淆,从而让破解者难以阅读。

Guess you like

Origin blog.csdn.net/i_nclude/article/details/74857657