"最小"源文件使用Eclipse创建+ ADT Android应用 [英] "Minimal" source files to create Android app using Eclipse + ADT

查看:113
本文介绍了"最小"源文件使用Eclipse创建+ ADT Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解一个最小的Andr​​oid应用程序的解剖结构,使用Eclipse + ADT(Android的开发工具包)。

I am trying to understand the anatomy of a MINIMAL Android application, using Eclipse + ADT (Android Development Toolkit).

请你能指教一下是最小的一套,我需要的源文件,例如: -

Please can you advise what is the MINIMAL set of source files I need, for example :-

src / package / MainActivity.java
res / layout / activity_main.xml
res / menu / activity_main.xml  (??)
AndroidManifest.xml
(any other source files needed?)

请你能指教一下是最小的,我需要投入每一个文件,以便为它的AVD(Android虚拟设备)?

Please can you advise what is the MINIMAL that I need to put into each file in order for it to run on the AVD (Android Virtual Device) ?

例如,这些文件必须包含引用(S)到其他文件等?

For example, which of these files needs to contain reference(s) to which other files, etc?

感谢您的时间和帮助,

最好的问候,

詹姆斯

推荐答案

严格地说最小的项目显示的的Hello World 的是

Strictly speaking the minimal project that displays Hello World is

.
├── AndroidManifest.xml
├── res
└── src
    └── com
        └── example
            └── minimal
                └── Minimal.java

Minimal.java

package com.example.minimal;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class Minimal extends Activity {

    /* (non-Javadoc)
     * @see android.app.Activity#onCreate(android.os.Bundle)
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final TextView tv = new TextView(this);
        tv.setText("Hello World!");
        setContentView(tv);
    }

}

的Andr​​oidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.minimal"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15" />

    <application android:label="Minimal">
        <activity android:name="Minimal">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>

    </application>

</manifest>

这篇关于&QUOT;最小&QUOT;源文件使用Eclipse创建+ ADT Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆