Results 1 to 8 of 8
  1. #1

    Lightbulb Textview font size

    hi gurus, just want to seek info.

    In textview is it better to set the size in sp units or what is the best option?

    if set to sp font will auto adjust to user settings or to screen sizes?

    Thanks for any input.

  2. #2

    sp is better option . it will adjust according to system font settings. but you have to do generic layout for fitting the text view in all kind of Big ,small or normal fonts.

    Last edited by venbab; 01-15-2015 at 11:22 PM. Reason: need to give mor appropriate answer

  3. #3
    SP units is a better option.

  4. #4
    You shouldn't have to set the text size manually. Use in XML android:textAppearance="?android:attr/textAppearanceMedium" for average textsize.
    Why? Because this way the text scales accordingly on different mobile devices.
    If you set 12Sp text will look ok on a xhdpi screen, but really small on xxxhdpi...

  5. #5
    Setting the font size to sp is a better option than using dp. However, if you want the fonts to self-adjust themselves according to screen size, then you must use the code android:textAppearance="?android:attr/textAppearanceLarge" or android:textAppearance="?android:attr/textAppearanceMedium" for large or medium fonts. Using this code will make the fonts dynamic so that they can adjust as per the screen sizes.

  6. #6
    Join Date
    Feb 2014

    Original Poster
    Thank you guys for the tip, i will need to update my app to android:textAppearance="?android:attr/textAppearanceMedium"

    Thank you all.

  7. #7
    Join Date
    Feb 2014

    Original Poster
    Text appearance Medium, large or small are also set on the res/values/themes.xml and is pre-defined by "sp" size also.

    <style name="TextAppearance.Medium">
    <item name="android:textSize">18sp</item>

  8. #8
    Sp is the better unit. On more queries , visit android development video at

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts