无法在布局文件中添加android自定义文本视图 [英] android custom text view can not be added in layout file

查看:100
本文介绍了无法在布局文件中添加android自定义文本视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义文本视图只是为了解决我之前的问题

I have created a custom text view just to solve the problem in my previous question

我已经阅读了许多教程和示例。我已经创建了一个自定义文本视图,但是不能将其添加到任何布局文件中。它只是在布局文件上引发错误,指出未找到该类。但是我写的是同一堂课。

I have gone through many tutorials and many samples. I have created a custom text view but it can not be added into any layout file. It just throws an error on layout file stating that the class is not found. However I have written the same class.

我想知道的是,创建自定义文本视图时需要注意些什么?我唯一的要求是创建一个自定义文本视图,以在我使用的所有文本视图中使用arial字体。

What i want to know is what should i need to take care when i am creating a custom text view? My only requirement to create a custom text view to have the arial fonts in all text views i use. And extend this facility for button views also.

谢谢

推荐答案

您只需使用完整的包名称和类添加视图:

You just add your view with full package name and class:

<org.path.to.MyTextView
android:id="@+id/MyTextView" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"/>

这篇关于无法在布局文件中添加android自定义文本视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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