请输入你要拨打的号码 拨打
然后在main.xml中添加几个属性,代码如下:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/input_into" />
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/phone_number"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/dial_caption"
android:id="@+id/dial_btn"/>t
layout为布局,修改Main.xml的代码后将有如图的显示效果:
在R.Java中将自动生成如下代码:public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int dial_btn=0x7f050001;
public static final int phone_number=0x7f050000;
}public static final class string {
public static final int app_name=0x7f040001;
public static final int dial_caption=0x7f040003;
public static final int hello=0x7f040000;
public static final int input_into=0x7f040002;
}
在PhoneActivity.java文件中,有如下代码:package cn.class3g.activity;import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;public class PhoneActivity extends Activity {