You can programmatically set the text size with the following code.
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18f);
Or, set the text size in res/values/dimensions.xml
as follows.
<?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="textsize">15sp</dimen> </resources>
Then, call the resource file like the following.
textView.setTextSize(getResources().getDimension(R.dimen.textsize));