无法获得string.setfont()方法的工作

时间:2014-04-25 14:33:07

标签: android string

我正在使用

String str;
tFace = Typeface.createFromAsset(getAssets(),"fonts/custom.ttf");
str.setFont(tFace);
在Android中的

..它出现在Cannot resolve method 'setFont(android.graphics.TypeFace)'

log cat显示: 错误:(137,24)错误:找不到符号方法setFont(Typeface)

使用str.setTypeface(tFace);出现了同样的错误..

知道如何解决这个问题吗?

提前致谢

2 个答案:

答案 0 :(得分:1)

setFont()根本就不存在。

使用setTypeface()

答案 1 :(得分:1)

使用setTypeFace在TextView或EditTextView上设置字体。 Android中的字符串没有这样的方法,它们只是对字符串进行操作,并且没有方法改变这些字符串在视觉上的表示方式