Android_UsingCar_Example 项目教程

Android_UsingCar_Example 项目教程

Android_UsingCar_Example基于高德地图Android API快速搭建用车解决方案的示例项目地址:https://gitcode.com/gh_mirrors/an/Android_UsingCar_Example

1. 项目的目录结构及介绍




Android_UsingCar_Example/


├── app/


│   ├── build.gradle


│   ├── src/


│   │   ├── main/


│   │   │   ├── java/


│   │   │   │   └── com.amap.usingcar/


│   │   │   │       ├── activity/


│   │   │   │       ├── adapter/


│   │   │   │       ├── model/


│   │   │   │       ├── service/


│   │   │   │       └── util/


│   │   │   ├── res/


│   │   │   │   ├── drawable/


│   │   │   │   ├── layout/


│   │   │   │   ├── menu/


│   │   │   │   ├── values/


│   │   │   │   └── ...


│   │   │   └── AndroidManifest.xml


│   │   └── test/


│   └── ...


├── build.gradle


├── settings.gradle


└── ...

目录结构介绍

app/: 主应用程序模块。
build.gradle: 应用程序的构建脚本。src/: 源代码目录。
main/: 主源代码目录。
java/: Java 源代码目录。
com.amap.usingcar/: 主包目录。
activity/: 存放所有活动(Activity)类。adapter/: 存放适配器(Adapter)类。model/: 存放数据模型(Model)类。service/: 存放服务(Service)类。util/: 存放工具(Util)类。 res/: 资源目录。
drawable/: 存放可绘制资源。layout/: 存放布局文件。menu/: 存放菜单文件。values/: 存放字符串、样式等资源。 AndroidManifest.xml: 应用程序的清单文件。 test/: 测试代码目录。

2. 项目的启动文件介绍

启动文件

MainActivity.java: 应用程序的主活动(Activity),通常是应用程序的入口点。




package com.amap.usingcar.activity;


 


import android.os.Bundle;


import androidx.appcompat.app.AppCompatActivity;


 


public class MainActivity extends AppCompatActivity {


    @Override


    protected void onCreate(Bundle savedInstanceState) {


        super.onCreate(savedInstanceState);


        setContentView(R.layout.activity_main);


        // 初始化代码


    }


}

启动文件介绍

MainActivity 继承自 AppCompatActivity,是应用程序的主界面。onCreate 方法中设置了布局文件 activity_main,并进行初始化操作。

3. 项目的配置文件介绍

配置文件

build.gradle: 应用程序的构建配置文件。




apply plugin: 'com.android.application'


 


android {


    compileSdkVersion 30


    defaultConfig {


        applicationId "com.amap.usingcar"


        minSdkVersion 21


        targetSdkVersion 30


        versionCode 1


        versionName "1.0"


        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"


    }


    buildTypes {


        release {


            minifyEnabled false


            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'


        }


    }


}


 


dependencies {


    implementation fileTree(dir: 'libs', include: ['*.jar'])


    implementation 'androidx.appcompat:appcompat:1.2.0'


    implementation 'com.amap.api:map2d:latest.release'


    implementation 'com.amap.api:navi-3dmap:latest.release'


    testImplementation 'junit:junit:4.13.1'


    androidTestImplementation 'androidx.test.ext:junit:1.1.2'


    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3




Android_UsingCar_Example基于高德地图Android API快速搭建用车解决方案的示例项目地址:https://gitcode.com/gh_mirrors/an/Android_UsingCar_Example

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...