因此,在我的TextView中,我有几个用斜杠分隔的电话号码,例如:
6723098/52378529 /(021)854745
现在,当我使用android:autoLink =“ phone”时,只有第一个数字可单击以自动拨号,如何设置所有三个数字为可单击和可呼叫?
提前谢谢。
爪哇
public class ShowRestActivity extends Activity {
String rest_tel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.show_rest);
TextView restTelLabel = (TextView) findViewById(R.id.restTelLabel);
restTelLabel.setText("6723098 / 52378529 / (021)854745");
Linkify.addLinks(restTelLabel, Patterns.PHONE, "tel:");
}
}
XML文件
<TextView
android:id="@+id/restTelLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:layout_marginBottom="10dp"
android:layout_below="@+id/restNameLabel"
android:autoLink="phone"/>
这些是有关电话号码的部分。
android:autoLink="phone"
从TextView的属性中删除。
尝试这个...
TextView textView = (TextView) findViewById(R.id.textviewid);
textView.setText("6723098 / 52378529 / (021)854745");
Linkify.addLinks(textView, Patterns.PHONE, "tel:");
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句