Device settings independent font size

前端 未结 3 1466
南旧
南旧 2021-01-21 04:11

While developing my app I realised if someone changes device font size from normal, my application font sizes change too and it destroys some of the visuals I designed. So I wan

3条回答
  •  耶瑟儿~
    2021-01-21 04:47

    If you want to completely ignore user's font size preferences, then use dp instead of sp for font sizes. The lint will complain about the dp usage (and rightly so, because you are potentially causing inconvenience to the user and possibly rendering your app unusable for visually impaired ones), but you should not face any runtime issues.

    If you just want to ignore runtime font size changes, use "fontScale":

    
        
            ...
        
    
    

提交回复
热议问题