小编sim*_*ple的帖子

在运行时更改字体大小android

我有一个textview和它大小32spxml

android:textSize="32sp"
Run Code Online (Sandbox Code Playgroud)

我想以28sp编程方式更改它。所以我使用了下面的代码。

txt.setTextSize(TypedValue.COMPLEX_UNIT_SP, getResources().getDimension(R.dimen.twenty_eight_sp));
Run Code Online (Sandbox Code Playgroud)

但是上面的代码是添加28sp32sp. 所以字体变得太大了。我不想添加字体大小,我想设置一个新的字体大小。

任何人都可以建议我。

android android-fonts android-xml

3
推荐指数
1
解决办法
4717
查看次数

标签 统计

android ×1

android-fonts ×1

android-xml ×1