How to assign text size in sp value using java code

后端 未结 11 2045
無奈伤痛
無奈伤痛 2020-12-04 05:14

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

11条回答
  •  醉酒成梦
    2020-12-04 06:06

    http://developer.android.com/reference/android/widget/TextView.html#setTextSize%28int,%20float%29

    Example:

    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 65);
    

提交回复
热议问题