Strada Android 开源项目教程

Strada Android 开源项目教程

strada-androidCreate fully native Android controls, driven by your web app.项目地址:https://gitcode.com/gh_mirrors/st/strada-android

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

Strada Android 项目的目录结构如下:




strada-android/


├── app/


│   ├── build.gradle


│   ├── src/


│   │   ├── main/


│   │   │   ├── AndroidManifest.xml


│   │   │   ├── java/


│   │   │   │   └── com/


│   │   │   │       └── hotwired/


│   │   │   │           └── strada/


│   │   │   │               └── demo/


│   │   │   └── res/


│   │   │       ├── drawable/


│   │   │       ├── layout/


│   │   │       ├── mipmap/


│   │   │       └── values/


├── build.gradle


├── gradle.properties


├── settings.gradle


└── README.md

目录结构介绍

app/: 包含应用程序的主要代码和资源文件。
build.gradle: 应用程序的构建脚本。src/: 源代码目录。
main/: 主源代码目录。
AndroidManifest.xml: 应用程序的清单文件。java/: Java 源代码目录。
com/hotwired/strada/demo/: 示例应用程序的包目录。 res/: 资源文件目录。
drawable/: 可绘制资源。layout/: 布局文件。mipmap/: 图标资源。values/: 字符串和其他值资源。 build.gradle: 项目的根构建脚本。gradle.properties: Gradle 配置属性文件。settings.gradle: 项目设置文件。README.md: 项目说明文档。

2. 项目的启动文件介绍

Strada Android 项目的启动文件是 app/src/main/java/com/hotwired/strada/demo/MainActivity.java。这个文件是应用程序的主活动,负责初始化应用程序并加载主界面。




package com.hotwired.strada.demo;


 


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.java: 主活动文件,继承自 AppCompatActivity,在 onCreate 方法中设置主布局文件 activity_main

3. 项目的配置文件介绍

Strada Android 项目的配置文件主要包括 app/build.gradleAndroidManifest.xml

app/build.gradle




apply plugin: 'com.android.application'


 


android {


    compileSdkVersion 30


    defaultConfig {


        applicationId "com.hotwired.strada.demo"


        minSdkVersion 21


        targetSdkVersion 30


        versionCode 1


        versionName "1.0"


    }


    buildTypes {


        release {


            minifyEnabled false


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


        }


    }


}


 


dependencies {


    implementation 'com.android.support:appcompat-v7:30.0.0'


    implementation 'com.android.support.constraint:constraint-layout:2.0.4'


    implementation project(':strada')


}

配置文件介绍

app/build.gradle: 应用程序的构建配置文件,定义了编译 SDK 版本、默认配置、构建类型和依赖项。

AndroidManifest.xml




<manifest xmlns:android="http://schemas.android.com/apk/res/android"


    package="com.hotwired.strada.demo">


 


    <application


        android:allowBackup="true"


        android:icon="@mipmap/ic_launcher"


        android:label="@string/app_name"


        android:roundIcon="@mipmap/ic_launcher_round"


        android



strada-androidCreate fully native Android controls, driven by your web app.项目地址:https://gitcode.com/gh_mirrors/st/strada-android

© 版权声明

相关文章

暂无评论

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