I am a beginner in android, I have a basichat doubt For setting font size what is most preferred in android sp, px or pt. Any help will appreciate
-
This question might help: https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dp-dip-and-sp-on-android – TuringTux May 29 '17 at 05:27
-
1Possible duplicate of [What is the difference between "px", "dp", "dip" and "sp" on Android?](https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dp-dip-and-sp-on-android) – TuringTux May 29 '17 at 05:28
-
This is a duplicate of https://stackoverflow.com/questions/23981260/should-use-sp-instead-of-dp-for-text-sizes – EKN May 29 '17 at 06:52
4 Answers
sp: Scale Independent Pixel, scaled based on user’s font size preference.Fonts should use sp.
sp is preferrable for setting font size.

- 52
- 8
Sp. Sp is scaled pixels. It scales with the text size the user sets. This means that people with problems seeing can set a larger base font size, and your text will scale with that setting. It makes it easier for those people to use the app.

- 90,003
- 9
- 87
- 127
SP Scale-independent Pixels
Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommended you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.
for Refrence more

- 4,162
- 4
- 18
- 31
Sp for font size
dp for any view width, height, margin, padding etc.
px not recommended in android development

- 869
- 1
- 16
- 36