什么是textview.setTextSize()? [英] What is textview.setTextSize()?
本文介绍了什么是textview.setTextSize()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Android游戏中,有一个textview.我正在使用以下代码设置文本大小.
In my android game, there is a textview. I am setting the text size using following code.
textview.setTextSize(30);
30
以像素为单位.但是到底是什么呢?是字符的高度还是宽度?是序号吗??
30
is in pixels. But what exactly it is ? Is it the height or width of a character ? Is it ordinal no. ?
推荐答案
要在android(java或kotlin)中设置文本大小,只需使用SP
for set text size in android (java or kotlin) just use SP
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
这篇关于什么是textview.setTextSize()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文