Android SetTextSize From Dimen

Setting the TextSize of your TextView from a dimension resource might not work at first. When setting make sure to use the getResource()

 text.setTextSize(getResources().getDimension(R.dimen.textsize));

dimens.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <dimen name="textsize">24sp</dimen>
</resources>
Posted in Android Tagged with: , ,