Should use “sp” instead of “dp” for text sizes

前端 未结 4 1991
清酒与你
清酒与你 2020-11-30 07:15

When I use

android:textSizes=\"20dp\" 

in my XML for a textView, I got a warning \"Should use \"sp\" instead of <

4条回答
  •  青春惊慌失措
    2020-11-30 08:19

    As @GiruBhai shared,it is more convenient to use sp instead of dp for the text size since it can be changed -unlike dp - according to the user's preferences.Which may be fulfilling your users needs better.

    More info. : Dimensions in Android

    Source : developer.android.com

提交回复
热议问题