setTextSize( float )
expects a scaled pixel value. So, setTextSize( 12 )
would give you the desired result. However, getDimension()
and getDimensionPixelSize()
return the size in units of pixels, so you need to use the unit-typed variant of setTextSize()
as follows:
setTextSize( TypedValue.COMPLEX_UNIT_PX, getDimensionPixelSize( R.dimen.tag_text_size ) );