标签:android http io os java ar 文件 sp cti
package  com.paad.helloworld;
import android.os.Bundle;
public class MyActivity extends Activity{
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
} 
 
Activity是应用程序中可见的交互组件的基类,它大致上等同于传统桌面应用程序开发中的窗体。上面这个例子,它扩展了Activity,重写了onCreate方法。
在android中,可视化组件称为视图(View),它们类似于传统桌面应用程序开发中的控件。因为setContentView可以通过扩展一个布局资源来对用户界面进行布局,所以我们重写了onCreate方法,用它来调用setContentView。
Android项目的资源存储在项目层次结构的res文件夹中,它包含了layout,values和一系列drawable子文件夹。ADT插件会对这些资源进行解释,并通过R变量来提供对它们的设计时访问。
下面的代码定义在由android项目模板创建,并存储在项目的res/layout文件夹中的UI布局:
<?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="wrap_content" android:text="@string/hello"/> </LinearLayout>
标签:android http io os java ar 文件 sp cti
原文地址:http://my.oschina.net/fhd/blog/316516