實現方式兩種:
1,在xml文件下很簡單的實現
只需要在textview屬性中加入android:autoLink="phone"。
<TextView
android:autoLink="phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0731-595262" />
2.在代碼里實現
對view添加點擊效果:
num為電話號碼,
"android.intent.action.CALL"為隱式Intent跳轉到撥打電話的activity
Intent intent=new Intent("android.intent.action.CALL",Uri.parse("tel:"+num));
startActivity(intent);