我有一个textview和它大小32sp在xml。
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)
但是上面的代码是添加28sp到32sp. 所以字体变得太大了。我不想添加字体大小,我想设置一个新的字体大小。
任何人都可以建议我。