TextView
来源:互联网 发布:电信网络宽带维修电话 编辑:程序博客网 时间:2024/05/18 22:53
首先设定TextView的clickable属性为true。
可以在布局文件中进行设定,比如:
<TextView
android:id="@+id/phone"
android:clickable="true" --------->设定此属性
android:layout_marginLeft="10dp"
android:layout_below="@id/address"
android:layout_toRightOf="@id/avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="18764563523"
android:textColor="@color/white" />
也可以在java代码中设定:
textView.setClickable(true);
然后绑定事件回调函数:
textView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
//调到拨号界面
Uri uri = Uri.parse("tel:18764563501");
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent);
}
});
完成TextView的点击事件绑定!
- TextView
- textView
- TextView
- TextView
- TextView
- textview
- TextView
- TextView
- TextView
- TextView
- TextView
- TextView
- TextView
- TextView
- TextView。。。。
- TextView
- textview
- TextView
- 使用 Hadoop 开发企业级应用
- 20160712
- react组件内部不能获取key
- FAIL - Deployed application at context path / but context failed to start
- POJ 1988 Cube Stacking (带权并查集)
- TextView
- hdu 5406CRB and Apple
- POJ 1945 Power Hungry Cows
- JZOJ 1420. 佳肴
- HBase配置和使用文档
- 【分页】Jquery分页排序插件 jPList
- Qt学习之路(49): 通用算法
- 数据库索引的实现原理
- mysql数据类型、字段类型