使用XML布局的TextView [英] Using XML layout for TextView

查看:182
本文介绍了使用XML布局的TextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Xamarin和我有以下的code:

I use Xamarin and I have the following code:

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);

我可以请有一定的帮助做同样的code,但与资源布局文件呢?

Can I please have some help to do the same code but with resource layout files instead?

在此先感谢

推荐答案

textview.xml:

textview.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只提

In onCreate just mention

setContentView(R.layout.textview);

这篇关于使用XML布局的TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆