在我们新建项目的时候,会遇到这样的一个窗口,首先我们认识一下这些都是什么,这样我们才能够更好的进行下一步的学习!

下面我们继续认识Android Studio

我们的Android项目创建完成之后,我们就可以进入我们的项目了!

我们的 Android项目 有三个主要的文件,如图所示
Activity:提供了用户与屏幕之间的互动,以便于用户进行操作,在里面实现主要的Java代码。
activity_main.xml:布局文件,Android的UI界面显示的视图,所有的控件在这里设计。
到这里,我们就已经认识完了Android Studio的基本页面,下面我们就可以编程Android项目了。
下面我们就进行一个简单的编程
(1)我们双击进入activity_main.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent" tools:context=".MainActivity"></LinearLayout>(2)接下来加入一个文本Testview和一个按钮Button
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent" tools:context=".MainActivity"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="准备好进入安卓的世界了吗?" android:id="@+id/tv_android"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="准备好了" android:id="@+id/bt_android" android:onClick="Welcome"/></LinearLayout>(3)打开手机模拟器


我们一次点击,会弹出下图对应的页面

到这里我们就可以选择一款你想要的手机型号,选择完成后点击下一步。

到了这一步,我们就可以选择手机的安卓版本,这里我选择的是安卓12的版本,我们点击Download下载,需要等待一段时间。

之后我们点击完成,至此我们就可以测试我们的程序了。
我们点击右上角的运行按钮

到这里,我们就完成了第一个安卓小程序的开发!
撒花完结!!!