android应用开发_android开发如何开发android应用

android应用开发

Android development is all the hype these days as it continues to dominate the world of mobile development. Fun projects, great pay, and tons of job prospects are just some of the reasons developers are starting their journeys into the exciting world of the Android operating system. Some experts say that there has never been a better time to learn Android skills, especially since the recent updates, like the addition of Kotlin and improvements to Google’s policies.

这些天来, Android开发一直是炒作,因为它继续主导着移动开发领域。 有趣的项目,丰厚的薪水和大量的工作前景只是开发人员开始踏入令人兴奋的Android操作系统世界的部分原因。 一些专家说,从来没有比现在更好的时间来学习Android技能,尤其是自从最近的更新以来,例如增加了Kotlin并改进了Google的政策。

If you’ve been thinking about starting your Android journey or you’re just curious about what Android has to offer, you’re in the right place! Today we will walk you through all the basics of Android development and even show you how to build your own functioning application.

如果您一直在考虑开始Android之旅,或者只是对Android提供的功能感到好奇,那么您来对地方了! 今天,我们将向您介绍Android开发的所有基础知识,甚至向您展示如何构建自己的功能应用程序。

Here’s what we’ll cover today:

这是我们今天要介绍的内容:

  • What is Android

    什么是Android
  • Android development tools

    Android开发工具
  • How to develop an Android app

    如何开发Android应用
  • Resources for Android app development

    Android应用开发资源

什么是Android? (What is Android?)

Image for post

Android is one of my world’s most popular operating systems for everything from 5G mobile devices to mobile apps to touchscreen smartphones and tablets. This open-source, Linux-based software is used by Google to power over 2.5 billion devices worldwide, accounting for over 80% of smartphone sales.

Android是我世界上最受欢迎的操作系统之一,从5G移动设备到移动应用到触摸屏智能手机和平板电脑,应有尽有。 Google使用这种基于Linux的开源软件为全球超过25亿台设备供电,占智能手机销售额的80%以上。

Android is based on the Linux kernel, which means that the basic operating structure is portable, multi-user, and able to handle complex multitasking. One of the biggest advantages of Android is the freedom of choice that comes with the technology. Not only is the hardware more diverse, but the software is very flexible and customizable.

Android基于Linux内核,这意味着基本的操作结构是可移植的,多用户的,并且能够处理复杂的多任务处理。 Android的最大优势之一是该技术带来的选择自由。 不仅硬件更加多样化,而且软件也非常灵活和可定制。

The market for Android development is growing as more and more manufacturers, including Samsung, Lenovo, HTC, and LG, turn to Android to power their products. This means that there’s a huge demand for Android developers worldwide in diverse industries and companies! On top of that, the new Google Play Store policies are the app development market much more lucrative. Learning Android skills will open doors and make you a desirable developer across the board.

随着越来越多的制造商(包括三星,联想,HTC和LG)转向使用Android驱动其产品,Android开发市场正在增长。 这意味着全球各行各业的Android开发人员都有巨大的需求! 最重要的是,新的Google Play商店政策使应用程序开发市场更加有利可图。 学习Android技能将为您打开大门,使您成为全面的理想开发人员。

Android开发工具 (Android development tools)

Getting started as an Android developer is easier than you might think; you’ll need to master some basic skills and tools, such as:

作为Android开发人员入门比您想象的要容易。 您需要掌握一些基本技能和工具,例如:

  • Programming language skills (Java, Kotlin, and Groovy)

    编程语言技能(Java,Kotlin和Groovy)
  • XML

    XML格式
  • Android build system

    Android构建系统
  • Android Studio IDE

    Android Studio IDE

编程语言技能 (Programming Language Skills)

Image for post

There are three programming languages and one markup language used in Android development.

Android开发中使用了三种编程语言和一种标记语言。

Java is the official language for Android development and one of the most popular programming languages in the world. Java classes run on Android Runtime (ART), a specialized virtual machine. Take a look at this example from the Android MainActivity.java file.

Java是Android开发的官方语言,也是世界上最受欢迎的编程语言之一。 Java类在专用的虚拟机Android Runtime(ART)上运行。 在Android MainActivity.java文件中查看此示例。

Image for post

Kotlin has been the second official language for Android development since 2017. Known for being much more concise and expressive, Kotlin helps alleviate some of Java’s drawbacks. Here’s an example of the above code in Kotlin so you can compare.

自2017年以来, Kotlin已成为Android开发的第二种官方语言。Kotlin以更加简洁和富于表现力而闻名,有助于缓解Java的某些弊端。 这是Kotlin中上述代码的示例,因此您可以进行比较。

Image for post

If you want to learn more about Kotlin, take a look at our article here to catch up on the basics.

如果您想了解有关Kotlin的更多信息,请在此处阅读我们的文章以了解基础知识。

XML, a markup language, is commonly used in Android development to declare a layout for user interface (UI), dimensions, and strings. Take a look at this example of a layout that shows text in the middle of the user’s screen.

XML是一种标记语言,在Android开发中通常用于声明用户界面(UI),尺寸和字符串的布局。 看一下此示例布局,该布局在用户屏幕中间显示文本。

Image for post

Android构建系统 (Android Build System)

Gradle powers the Android build automation system and expands upon the concepts of Apache Maven and Apache Ant by introducing a Groovy-based, domain-specific language. Groovy is an optionally typed, dynamic language with static-typing capabilities. It helps improve productivity and speed by integrating with your Java-based program. With Groovy’s ease and Gradle’s mature ecosystem, you can automate your software and deliver much faster builds.

Gradle支持Android构建自动化系统,并通过引入基于Groovy的特定领域语言扩展了Apache Maven和Apache Ant的概念。 Groovy是一种可选类型的动态语言,具有静态键入功能。 通过与基于Java的程序集成,它有助于提高生产率和速度。 借助Groovy的便捷性和Gradle的成熟生态系统,您可以使软件自动化并提供更快的构建。

Android Studio IDE (Android Studio IDE)

The Android Studio IDE is your new best friend for Android development. Based on IntelliJ IDEA, it’s the official development environment for Google’s operating system. It comes with great Android-specific tooling to cover all your needs. Using this IDE will accelerate your development time, and frequent updates mean you’ll never fall behind. It comes loaded with the following features, amongst many others:

Android Studio IDE是您进行Android开发的新最好朋友。 它基于IntelliJ IDEA,是Google操作系统的官方开发环境。 它带有出色的Android专用工具,可以满足您的所有需求。 使用此IDE将缩短您的开发时间,并且频繁的更新意味着您永远不会落后。 它具有以下功能,以及许多其他功能:

  • Realtime profilers and analyzer

    实时分析器和分析器
  • Flexible build system

    灵活的构建系统
  • Intelligent code editor

    智能代码编辑器
  • Visual layout editor

    视觉布局编辑器
  • Fast emulator

    快速模拟器

Android SDK (Android SDK)

The Android SDK is the official development kit for Android app development. It is composed of modular packages that can be separately downloaded from the Android SDK Manager, including SDK tool, Google API, Android support, Android Debug Bridge (ADB), and more. Just like the IDE, the Android SDK is always being updated. New releases will keep you up to date with the latest features.

Android SDK是用于Android应用程序开发的官方开发工具包。 它由可从Android SDK管理器单独下载的模块化程序包组成,包括SDK工具,Google API,Android支持,Android调试桥(ADB)等。 就像IDE一样,Android SDK总是在更新。 新版本将使您了解最新功能。

如何开发Android应用 (How to develop an Android app)

适用于Android的Java (Java for Android)

When it comes to creating Android apps, your knowledge of Java is paramount to your success. Java is the official language for developing Android applications, and it supports all of the Android tools. Knowledge of this language will make your dev experience much easier.

在创建Android应用程序时,您对Java的知识对您的成功至关重要。 Java是用于开发Android应用程序的官方语言,它支持所有Android工具。 了解这种语言将使您的开发人员体验变得更加轻松。

Java was chosen for Android development because it is well-known, well-supported by development tools, and already pervasive in the mobile phone industry. On top of that, Java runs in a VM, so it doesn’t need to be recompiled.

选择Java进行Android开发是因为Java广为人知,并且得到开发工具的大力支持,并且已经在手机行业普及。 最重要的是,Java在VM中运行,因此不需要重新编译。

Before you can start your Android dev journey, you need to get up to speed on Java. If you’re looking to get started with Java, check out Educative’s free courses.

在开始Android开发之旅之前,您需要掌握Java的最新知识。 如果您希望开始使用Java,请查看Educative的免费课程

安装Android Studio IDE (Install Android Studio IDE)

Image for post

To get started with Android development, you need to install the Android Studio IDE. This user-friendly, drag-and-drop interface is the official IDE development environment. It is purpose-built for high-quality Android apps. This IDE will speed up your development time and make your apps far more reliable and easier to update when new features are released.

要开始进行Android开发,您需要安装Android Studio IDE。 这个用户友好的拖放界面是官方的IDE开发环境。 它是专为高质量Android应用而构建的。 此IDE将加快您的开发时间,并在发布新功能时使您的应用程序更加可靠并且更易于更新。

To install Android Studio on Windows, follow these steps.

要在Windows上安装Android Studio,请按照以下步骤操作。

  1. Visit this link to get the latest version of Android Studio.

    访问此链接以获取最新版本的Android Studio。

  2. You can either download the IDE as a .exe file or a .zip file. For the .exe file, double click the file to launch it. For the .zip file, unpack the ZIP and copy the android-studio folder to your Program files.

    您可以将IDE下载为.exe文件或.zip文件。 对于.exe文件,双击该文件以启动它。 对于.zip文件,请解压缩ZIP文件并将android-studio文件夹复制到您的程序文件中。

  3. This will prompt you to open and launch the android-studio > binfolder.

    这将提示您打开并启动android-studio > bin文件夹。

  4. Once prompted, follow the Android Studio setup wizard, where you can select your SDK packages.

    出现提示后,请按照Android Studio设置向导进行操作,您可以在其中选择SDK包。

To install Android Studio on Mac, follow these steps.

要在Mac上安装Android Studio,请按照以下步骤操作。

  1. Visit this link to get the latest version of Android Studio.

    访问此链接以获取最新版本的Android Studio。

  2. Once downloaded, launch the DMG file and drag it to your Applications folder.

    下载后,启动DMG文件并将其拖到“应用程序”文件夹中。
  3. Launch Android Studio. From here, you can either start a new project or import previous settings.

    启动Android Studio 。 从这里,您可以开始一个新项目或导入以前的设置。

  4. Follow the setup wizard prompts to select your SDK components.

    按照安装向导的提示选择您的SDK组件。

If you aren’t ready to download Android Studio IDE, you can also check out Educative’s course with a unique pre-configured Andoird widget

如果您还不准备下载Android Studio IDE,则还可以通过独特的预配置Andoird小部件查看Educative的课程

创建一个Hello World应用程序 (Creating a Hello World Application)

Image for post

步骤1:Android应用的结构 (Step 1: Structure of an Android App)

Now that we have our IDE, how do we actually make an Android project? First, let’s look at the structure of a typical Android project.

现在我们有了IDE,我们如何真正制作一个Android项目? 首先,让我们看一个典型的Android项目的结构。

app — root module folder

app —根模块文件夹

  • build.gradle — module config file

    build.gradle —模块配置文件

  • src/main/AndroidManifest.xml — module manifest file

    src / main / AndroidManifest.xml —模块清单文件

  • src/main/java — module source folder for Java or Kotlin files

    src / main / java -Java或Kotlin文件的模块源文件夹

  • src/main/res — module resource folder

    src / main / res —模块资源文件夹

build.gradle — project config file

build.gradle —项目配置文件

gradle, gradle.properties, gradlew, gradlew.bat — Gradle related files for to build Android project

gradlegradle.propertiesgradlewgradlew.bat —与Gradle相关的文件,用于构建Android项目

settings.gradle — project settings file

settings.gradle-项目设置文件

Image for post

项目文件 (Project Files)

The settings.gradle file contains a list of your modules and project name. Keep in mind that an Android project can consist of one or several modules, which can each contain their own feature or logic. The gradle.propertiesfile defines your settings and configures a build environment.

settings.gradle文件包含您的模块和项目名称的列表。 请记住,一个Android项目可以包含一个或几个模块,每个模块可以包含自己的功能或逻辑。 gradle.properties文件定义您的设置并配置构建环境。

The gradle, gradlew, and gradlew.bat files are related to Gradle wrapper, so we don’t have to manually install Gradle.

gradlegradlewgradlew.bat文件与Gradle包装器相关,因此我们不必手动安装Gradle。

build.gradle is a top-level build file. Here we can add configuration options shared by all modules. For example, you can give your files access to repositories for core Android functionalities.

build.gradle是顶级构建文件。 在这里,我们可以添加所有模块共享的配置选项。 例如,您可以授予文件访问Android核心功能存储库的权限。

模块文件 (Module files)

Each module has a unique name where we put the application source code. The module build.gradle file contains the configurations related to this module only, such as:

每个模块都有一个唯一的名称,用于放置应用程序源代码。 模块build.gradle文件仅包含与此模块相关的配置,例如:

  • compileSdkVersion - the version of Android SDK to compile the project

    compileSdkVersion用于编译项目的Android SDK版本

  • minSdkVersion - the minimal supported Android version

    minSdkVersion最低支持的Android版本

  • targetSdkVersion - the target version of Android SDK, used to tell the system to enable compatibility behaviors

    targetSdkVersion -Android SDK的目标版本,用于告诉系统启用兼容性行为

  • applicationId - unique identifier of the application on the device and in Google Play Store

    applicationId设备和Google Play商店中applicationId唯一标识符

  • versionCode - an internal version number

    versionCode内部版本号

  • versionName - the version name displayed to users

    versionName向用户显示的版本名称

  • compileOptions - compile options to achieve some features of Java 1.8

    compileOptions编译选项以实现Java 1.8的某些功能

  • dependencies - first-party and third-party library dependencies, discussed in the next lessons

    dependencies -第一方和第三方库依赖关系,在下一课中将进行讨论

Image for post

The AndroidManifest.xml is where we declare our main components. For example, a manifest file for a travel blog might contain the following things:

我们在AndroidManifest.xml中声明我们的主要组件。 例如,旅行博客的清单文件可能包含以下内容:

  • package - the package name of the application, in our case com.travelblog

    package -应用程序的包名,在我们的例子com.travelblog

  • theme - the global application theme, in our case MaterialComponents theme

    theme全局应用程序主题,在本例中为MaterialComponents主题

  • label - the label which is used as a value for the application icon

    label标签,用作应用程序图标的值

  • activity - the activity, we currently only have one MainActivity

    activity -该活动,我们目前只有一个MainActivity

All resource-related files need to be placed inside predefined, sub-folders of the src/main/res folder. One subfolder, for example, is the layout folder for all your layout files. We will also have the src/main/java folder for our Java source code.

所有与资源相关的文件都必须放置在src / main / res文件的预定义子文件夹中。 例如,一个子文件夹是所有布局文件的布局文件夹。 我们还将为Java源代码提供src / main / java文件夹。

第2步:Android库 (Step 2: Android Libraries)

An important part of creating your application is the unique features and tools you add to it. That’s where libraries come into play. A library is a collection of pre-written resources that can be added to your app. The Android library ecosystem is large, and you can use dozens of libraries in a single project. You can access most of the Android libraries through maven.

创建应用程序的重要部分是添加到应用程序中的独特功能和工具。 那就是图书馆发挥作用的地方。 库是可以添加到您的应用程序中的预写资源的集合。 Android库生态系统很大,您可以在一个项目中使用数十个库。 您可以通过maven访问大多数Android库。

Adding a library to your project is easy: declare the group id, artifact id, and version in the dependencies section of your app/build.gradle file.

向您的项目中添加库很容易:在app / build.gradle文件的dependencies部分中声明组ID,工件ID和版本。

Image for post

Here are some of the most popular libraries in use today:

以下是当今使用的一些最受欢迎的库:

  • appcompat — makes the apps developed with newer versions work with older versions

    appcompat-使使用较新版本开发的应用程序可与较旧版本一起使用

  • constraintlayout — allows creating large and complex layouts with a flat view hierarchy

    约束布局-允许创建具有平面视图层次结构的大型复杂布局

  • material — brings material design components to Android

    material —将材质设计组件带到Android

  • retrofit — a type-safe HTTP client library

    改造 —类型安全的HTTP客户端库

  • moshi — a JSON parser library

    moshi — JSON解析器库

  • glide — an image loading library

    glide —图像加载库

  • room — an official Android ORM database

    —官方的Android ORM数据库

  • dagger — a static, compile-time dependency injection framework

    dagger —静态的编译时依赖项注入框架

Appcompat

Appcompat

The appcompat library is great for solving compatibility issues between newer and older versions of your app. Its primary component is AppCompatActivity. This base class enables backward compatibility with older versions of Android apps. To add it to your app, use the following code:

appcompat库非常适合解决应用程序新旧版本之间的兼容性问题。 它的主要组件是AppCompatActivity 。 这个基本类别可与旧版Android应用程式向后相容。 要将其添加到您的应用中,请使用以下代码:

implementation 'androidx.appcompat:appcompat:1.1.0'

Constraint layout

约束布局

This library enables you to create complex layouts using a flat view hierarchy. It is common to use ConstraintLayout as the root of all the layout files. To add it to your app, use the following code:

该库使您可以使用平面视图层次结构创建复杂的布局。 通常将ConstraintLayout用作所有布局文件的根。 要将其添加到您的应用中,请使用以下代码:

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Image for post

Material design

材料设计

This library brings Material Design components to your app. Material design is a design language used to make your various components more user-friendly. You can take a look at the list of components here. To add it to your app, use the following code:

该库将Material Design组件引入您的应用程序。 材料设计是一种设计语言,用于使您的各个组件更加人性化。 您可以在此处查看组件列表。 要将其添加到您的应用中,请使用以下代码:

implementation 'com.google.android.material:material:1.1.0-alpha10'

步骤3:Android活动 (Step 3: Android Activity)

One of the core components of Android is activity, one screen of the application user interface. An application is comprised of multiple activities that can be launched on top of each other to form a back stack. A user can navigate through this back stack using the UI components, i.e. a back button.

Android的核心组件之一是活动,即应用程序用户界面的一个屏幕。 一个应用程序由多个活动组成,这些活动可以相互启动以形成后退堆栈。 用户可以使用UI组件(即后退按钮)浏览该后退堆栈。

For example, an app may have the following components:

例如,一个应用可能具有以下组件:

  • LoginActivity — represents login flow

    LoginActivity —代表登录流程

  • ListActivity — represents a list of recent article titles

    ListActivity —表示最近文章标题的列表

  • DetailActivity — represents an article itself

    DetailActivity —表示文章本身

Activities have their own lifecycles, so the Activity class offers six core callbacks: onCreate( ), onStart( ), onResume( ), onPause( ), onStop( ), onDestroy( ). When the user leaves an activity, the system will dismantle the activity by calling different methods. You can use these methods to check when an activity is being created or destroyed, becomes visible or hidden, etc.

活动具有自己的生命周期,因此Activity类提供了六个核心回调: onCreate( )onStart( )onResume( )onPause( )onStop( )onDestroy( ) 。 当用户离开活动时,系统将通过调用不同的方法来取消活动。 您可以使用这些方法来检查活动何时被创建或破坏,变得可见或隐藏等。

Image for post

Creating an activity involves two main steps: make a Java class and extend it from the Activity superclass. You could then use the library AppCompatActivity to achieve backward compatibility. Android activities must then be declared in the AndroidManfiest.xml file.

创建活动涉及两个主要步骤:创建Java类并从Activity超类对其进行扩展。 然后,您可以使用库AppCompatActivity来实现向后兼容性。 然后必须在AndroidManfiest.xml文件中声明Android活动。

步骤4:Android版式 (Step 4: Android Layout)

Another key aspect of Android development is developing and working with Android layout. The layout defines the overarching structure of your UI (user interface). These are built using views and view groups.

Android开发的另一个关键方面是开发和使用Android布局。 布局定义了UI(用户界面)的总体结构。 这些是使用视图和视图组构建的。

Views, also called widgets, might be components such as TextView (render text), EditText (user can type text), and Button (clickable text).

视图 (也称为窗口小部件)可能是诸如TextView (呈现文本), EditText (用户可以键入文本)和Button (可单击文本)之类的组件。

ViewGroups, sometimes called layouts, are like invisible containers that determine where certain elements will be housed. This is where you might use the Google library ContraintLayout, which uses constraints to position your widgets. The Android SDK method is simpler for beginners but offers less flexibility.

ViewGroups有时也称为布局,就像不可见的容器一样,用于确定某些元素的放置位置。 您可以在这里使用Google库ContraintLayout ,该库使用约束来定位窗口小部件。 对于初学者来说,Android SDK方法较为简单,但灵活性较低。

The easiest way to build a layout is by using an XML file rather than Java code. We can then bind or inflate this layout to an activity. Let’s build a layout to see how it’s done.

建立布局的最简单方法是使用XML文件而不是Java代码。 然后,我们可以将此布局绑定或膨胀到活动。 让我们构建一个布局,看看它是如何完成的。

First, inside your app/src/main/res/layout folder, create an activity_main.xmllayout file. In this example, we will use a root layout through ConstraintLayout alongside some XML attributes:

首先 ,在您的app / src / main / res / layout文件夹中,创建一个activity_main.xml布局文件。 在此示例中,我们将通过ConstraintLayout使用根布局以及一些XML属性:

  • layout_width="match_parent": this defines the width of the layout.

    layout_width="match_parent" :这定义布局的宽度。

  • android:layout_height="match_parent": this defines the height of the layout

    android:layout_height="match_parent" :这定义了布局的高度

  • xmlns:android and xmlns:app: these define XML namespace, Android namespace for attributes from Android SDK, and app namespace for attributes from libraries

    xmlns:androidxmlns:app :这些定义XML名称空间,用于Android SDK中属性的Android名称空间以及用于库中属性的应用程序名称空间

Image for post

Secondly, we need to fill our empty layout by defining a child view. In this case, we will define static text that reads “Hello World”. To do so, we use a TextView and the text attribute. We will use wrap_content so the view will take up as much space as possible.

其次 ,我们需要通过定义子视图来填充我们的空白布局。 在这种情况下,我们将定义读取“ Hello World”的静态文本。 为此,我们使用TextViewtext属性。 我们将使用wrap_content以便视图将占用尽可能多的空间。

Image for post

Now that we’ve built our views, we move onto alignment. We want to move our text to the center of the screen since the default positions our views in the upper left corner. To do so, let’s add the following constraints:

现在,我们已经建立了视图,现在我们进入对齐 。 由于默认位置我们的视图位于左上角,因此我们希望将文本移动到屏幕的中心。 为此,我们添加以下约束:

  • layout_constraintTop_toTopOf: this declares a constraint to align the top of the view to the top of the ConstraintLayout

    layout_constraintTop_toTopOf :这声明一个约束,以将视图的顶部与ConstraintLayout的顶部对齐

  • layout_constraintBottom_toBottomOf: this declares a constraint to align the bottom of the view to the bottom of the ConstraintLayout

    layout_constraintBottom_toBottomOf :这声明一个约束,以使视图的底部与ConstraintLayout的底部对齐

  • layout_constraintLeft_toLeftOf: this declares a constraint to align the left of the view to the left of the ConstraintLayout

    layout_constraintLeft_toLeftOf :这声明一个约束,以使视图的左侧与ConstraintLayout的左侧对齐

  • layout_constraintRight_toRightOf: this declares a constraint to align the right of the view to the right of the ConstraintLayout

    layout_constraintRight_toRightOf :这声明一个约束,以使视图的右边与ConstraintLayout的右边对齐

Image for post
Image for post

Now that everything is aligned where we want it, we move onto layout binding. This serves to associate activity_main.xmllayout with the MainActivity. We do this using the setContentView method when an activity is created inside the onCreate method.

现在,所有内容都在我们想要的位置对齐了,我们继续进行布局绑定 。 这用于将activity_main.xmllayoutMainActivity关联。 当在onCreate方法内创建活动时,我们使用setContentView方法执行此操作。

The method setContentView accepts the layout resource ID. This is referenced by the auto-generated Android R class, where all the resource IDs are stored. For binding purposes, we can use the R.layout.activity_mainto obtain the ID of activity_main.xml so we can tell MainActivity to render layout from this file.

setContentView方法接受布局资源ID。 自动生成的Android R类引用了该类,其中存储了所有资源ID。 出于绑定目的,我们可以使用R.layout.activity_main获取activity_main.xml的ID,以便我们可以告诉MainActivity从该文件中渲染布局。

Image for post

The final step is view binding, which enables us to interact with views on runtime. To do so, we bind the view from XML to Java object.

最后一步是视图绑定 ,这使我们能够在运行时与视图进行交互。 为此,我们将视图从XML绑定到Java对象。

First, we define a new ID for the TextView using the id attribute with @+id/mainTextView value.

首先,我们使用带有@ + id / mainTextView值的id属性为TextView定义新的ID。

Image for post

We can now bing the TextView from XML to Java object using the findViewById method. The setText method will change our text to make it interactive.

现在,我们可以使用findViewById方法将TextView从XML findViewById到Java对象。 setText方法将更改文本以使其具有交互性。

Image for post
Image for post

Now you know the basic build and layout process for an Android application! It’s time for you to get started on your own! In the next section, we’ll walk you through some important resources to get you started.

现在您知道了Android应用程序的基本构建和布局过程! 是时候开始自己动手了! 在下一节中,我们将引导您完成一些重要的资源,以帮助您入门。

Android开发资源 (Resources for Android Development)

Image for post

来自Google和Android的官方资源 (Official Resources from Google and Android)

学习基础 (Learn the Basics)

对于中级/高级开发人员 (For intermediate/advanced developers)

是否想立即开始Android开发? (Want to get started with Android development right now?)

One of the best resources out there for developers of all levels is Modern Android App Development with Java, a hands-on, project-based course that walks through every stage of development. As you learn, you’ll build a fully functional Travel Blog Application.

对于所有级别的开发人员来说,最好的资源之一就是使用Java的Modern Android App Development ,这是一个动手的,基于项目的课程,它涵盖了开发的各个阶段。 在学习过程中,您将构建功能齐全的Travel Blog应用程序。

On top of that, the course comes with Educative’s unique pre-configured Android environment, so you don’t have to download anything to get started. It’s one of the only courses out there with this powerful widget!

最重要的是,该课程随附Educative独特的预配置Android环境,因此您无需下载任何内容即可开始使用。 这是使用此功能强大的小部件的仅有的课程之一!

Image for post

The course begins with a basic intro and moves through each stage of development, including…

该课程从基本介绍开始,贯穿开发的每个阶段,包括…

  • Intro to Android

    Android简介
  • Login screen

    登入画面
  • Details screen

    详细信息屏幕
  • List screen

    清单画面
  • Search and sort

    搜索和排序
  • Offline functionalities

    离线功能
  • Additional resources

    额外资源
  • and more

    和更多

It’s never been easier to get started with Android development to propel your career into the future!

开始使用Android开发推动您的职业生涯走向未来从未如此轻松!

Happy learning!

学习愉快!

翻译自: https://medium.com/educative/android-development-how-to-develop-an-android-app-bcbe0e2c469a

android应用开发

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值