我想在代码中将TextView
的文本设置为加粗样式,而不是通过XML来实现。
我想在代码中将TextView
的文本设置为加粗样式,而不是通过XML来实现。
如何通过编程使TextView加粗
可以用以下方式:
TextView.setTypeface(null, Typeface.BOLD);
textView.setTypeface(null, Typeface.BOLD_ITALIC);
textView.setTypeface(null, Typeface.BOLD);
textView.setTypeface(null, Typeface.ITALIC);
textView.setTypeface(null, Typeface.NORMAL);
并且:
import android.graphics.Typeface;