How do you set the font size of a textview in android?

To set the font size of a TextView, you can use the setTextSize() method. This method has two parameters: the first parameter is the unit and the second parameter is the font size. For example, if you want to set the font size of a TextView to 18sp, you can use the following code:

TextView textView = findViewById(R.id.textView);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);

Please make sure to replace R.id.textView with the ID of your TextView.

bannerAds