1

我使用 Xamarin,我有以下代码:

base.OnCreate (bundle);

TextView textView = new TextView (this.ApplicationContext);
textView.AutoLinkMask = Android.Text.Util.MatchOptions.PhoneNumbers; 
textView.Text = "This is a phone number 0800 32 32 32";

//Linkify.AddLinks(textView, MatchOptions.PhoneNumbers);

SetContentView(textView);

我可以请一些帮助来执行相同的代码但使用资源布局文件吗?

提前致谢

4

2 回答 2

3

文本视图.xml:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is a phone number 0800 32 32 32"
android:autoLink="phone">
</TextView>

在 onCreate 中只提到

setContentView(R.layout.textview);
于 2014-01-18T06:03:27.743 回答
1
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/textview"
  android:text="This is a phone number 0800 32 32 32"
  android:autoLink="phone"
/>
于 2014-01-18T06:06:53.670 回答