Android笔记(二):第一个Android程序
上一节介绍的Eclipse中安卓程序的一些基本知识,这一节将创建第一个Android程序。
新建Android项目,向导中的参数具体如下图:
我们将按两种方式来实现一个显示“Hello World ”的程序:
第一种是程序编码方式:
找到Text.java,在onCreate(Bundle savedInstanceState)方法里面,添加如下代码:
TextView textView = new TextView(this); textView.setText("Hello World "); setContentView(textView);
<string name="showInfo">我的第一个安卓程序</string>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" />
android:text="@string/hello"
android:text="@string/showInfo"
