如何用java code的SP值赋给文本大小 [英] How to assign text size in sp value using java code

查看:123
本文介绍了如何用java code的SP值赋给文本大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我给你一个整数值用java code来改变一个TextView有一定的文字大小,该值PTED为像素(PX)除$ P $,现在没有人知道如何在SP分配?

If I assign an integer value to change a certain text size of a TextView using java code, the value is interpreted as pixel (px), now does anyone know how to assign in sp?

推荐答案

<一个href="http://developer.android.com/reference/android/widget/TextView.html#setTextSize%28int,%20float%29">http://developer.android.com/reference/android/widget/TextView.html#setTextSize%28int,%20float%29

例如:

textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 65);

这篇关于如何用java code的SP值赋给文本大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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