Set font size on phone and tablet

后端 未结 4 1102
一个人的身影
一个人的身影 2021-01-26 06:51

How to set the font size for a textview in a phone and a tablet. The posts I\'ve referred suggested to creating dimen.xml and placing them in different folders name

相关标签:
4条回答
  • 2021-01-26 07:23

    For tablets I use:

    • values-sw600dp for 7″
    • values-sw720dp for 10″

    This slution can be used not just for localizing dimensions but also other values (for instance, styles).

    0 讨论(0)
  • 2021-01-26 07:23

    It looks you got misunderstood from references. You should takes values, values-large folders for variation in fonts of Phone and Tablet. And for better results keep using sp units rather than dp for Font Size

    0 讨论(0)
  • 2021-01-26 07:35

    I tryed this will work text size set default size

    create :android/res/values/styles.xml

    <style name="Widget.TextView">    
     <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>    
    </style>
    <style name="TextAppearance.Small">  
    <item name="android:textSize">14sp</item>    
    <item name="android:textStyle">normal</item>    
    <item name="android:textColor">?textColorSecondary</item>    
    </style>
    

    where

    <item name="textColorSecondary">@android:color/secondary_text_dark</item>
    

    these colors are defined in /res/color/, check /res/color/secondary_text_dark.xml

    0 讨论(0)
  • 2021-01-26 07:37

    You could just use sp units instead. It is a lot simpler.

    0 讨论(0)
提交回复
热议问题