APP开发资讯 傻瓜式Android APP设备初学教程 | 菜鸟教程

你的位置:软件app开发公司 > 关于我们 > APP开发资讯 傻瓜式Android APP设备初学教程 | 菜鸟教程
APP开发资讯 傻瓜式Android APP设备初学教程 | 菜鸟教程
发布日期:2024-07-18 14:21    点击次数:114

这篇著作东要先容了Android APP设备初学教程,从SDK下载、设备环境搭建、代码编写、APP打包等阵势逐一西宾APP开发资讯,相配简明的一个Android APP设备初学教程,需要的一又友不错参考下。

责任中有作念过手机App面貌,前端和android或ios顺次员合作完成系数项目标设备,设备经过中与ios顺次合作基本没什么问题,而android多样机子和rom的问题许多,这也让我产生了学习android和ios顺次设备的好奇羡慕。于是凌晨极少睡不着写了第一个android顺次HelloAndroid,po出来共享给其他也念念学习android设备的一又友,这样傻瓜的Android设备初学著作,有极少设备基础的应该王人能看懂。

一、准备责任

主要以我我方的设备环境为例,下载装置JDK和Android SDK,假如你莫得现成的IDE,你不错径直下载SDK完竣包,内部包含了Eclipse,若是有IDE那么你不错革新到底下接管USE AN EXISTING IDE,然后装置SDK,若是你的SDK在装置时找不到JDK目次,你不错在系统环境变量里添加JAVA_HOME变量,旅途为你的JDK目次,我的IDE是IntelliJ IDEA,王人装好以后开动建立IDE增多SDK撑合手。

率先,掀开Android SDK Manager把Android 4.0以上版块的未装置的王人打勾装上,把柄你个东说念主骨子情况,若是你只筹划用我方的手机测试,那就把你机子系息争样版块的SDK包装上,下载时辰有点长。

Android SDK Manager

然后掀开IDE创建新面貌,IDEA相比智能,若是你装好了SDK,新建面貌里就会出现Android的Application Module,接管后右边Project SDK为空,点击New按钮,找到SDK目次详情,APP开发资讯下拉列表就会列出照旧装置的各个版块的SDK,接管我方需要的版块,若是是第一次设备,IDE会提醒你先设备JDK,把柄教导找到JDK目次即可。

select-android-sdk

填好面貌称呼后下一步接管USB Device,然后完成面貌构建,IDE会自动生成基本的面貌所需的文献及目次。

new-android-project

android-project-files

二、代码编写

作念好准备责任后,终于不错开动写咱们的hello android了,在开动编写代码之前,咱们先了解几个文献:

res/layout/main.xml App主窗体布局文献,你的哄骗长什么样王人在这鸿沟说,有Design和Text两种模式

res/values/strings.xml 不错默契为i18n文献,这个文献用来存放顺次调用的多样字符串

src/com/example/helloandroid/MyActivity.java 这个等于咱们的主顺次类,等下要罢了的功能王人在这个文献里添加

率先为哄骗添加一个id为hellotextView的textview和一个id为hellobutton的button,mail.xml 代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
        >
    <TextView
            android:layout_width="fill_parent"
            android:layout_height="180dp"
            android:text="@string/default_message"
            android:id="@+id/hellotextView" android:textColor="#00ff00" android:gravity="center"/>
    <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/button_send"
            android:id="@+id/hellobutton" android:layout_gravity="center"/>
</LinearLayout>

代码和控件用到的字符串界说如下:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">helloandroid by hiwanz</string>
    <string name="button_send">Say something</string>
    <string name="default_message">Click button below!</string>
    <string name="interact_message">You just clicked on the Button!</string>
</resources>

主顺次中界说button点击后变嫌textview线路的文本,况兼弹出Toast教导信息,代码如下:

package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MyActivity extends Activity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //赢得按钮实例
        Button hellobtn = (Button)findViewById(R.id.hellobutton);
        //设备监听按钮点击事件
        hellobtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //赢得textview实例
                TextView hellotv = (TextView)findViewById(R.id.hellotextView);
                //弹出Toast教导按钮被点击了
                Toast.makeText(MyActivity.this,"Clicked",Toast.LENGTH_SHORT).show();
                //读取strings.xml界说的interact_message信息并写到textview上
                hellotv.setText(R.string.interact_message);
            }
        });
    }

}

代码写好后,电脑通过USB数据线连结办机,手机系统设备里的设备东说念主员选项里掀开USB调试,在IDE中径直点Run就不错在手机上看到运行的后果了。

helloandroid-1

helloandroid-2

哄骗打包

哄骗设备完成后就要打包发布了,在IDE的Build菜单下接管Generate Signed APK来打包哄骗

generate-signed-apk

在弹出的Wizard对话框中需要指定签名的Key,一开动莫得Key你不错点击Create New来新建一个Key用于签名,填入签名所需的一些字段青年景Key文献

signification-keygen

软件开发

使用生成的Key来签名哄骗包

连码分析:最近10期5期开出连码组合,连码走势较热,本期推荐连号34 35。

第一位推荐:最近30期该位0路号码开出14个,目前遗漏0期,其中号码0出现3次,目前遗漏10期;号码9出现4次,目前遗漏5期;号码6出现4次,目前遗漏3期;号码3出现3次,目前遗漏0期。

apk-publish-wizard

apk-publish-wizard-done

完成编译后会在刚才咱们设备的Designation APK path下生成咱们的helloandroid.apk哄骗包,接下来要怎么装置哄骗应该无谓说了吧,咱们的第一个Android App就这样出生了。

开始:http://www.jb51.net/article/50395.htmAPP开发资讯