Android setTextSize Unit Parameter

Jul 25, 2018
Set Text Size in PX or SP

setTextSize in Pixel

textView.textSize = 18.0F// ortextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, 18.0F)

NOTE: setTextSize parameter size is float: The scaled pixel size..

setTextSize in SP

textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10.0F)

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.