I am developing an android application. My designer gave me designs with font size 48PT in photoshop. For android how many DPs should I set in font size?
Asked
Active
Viewed 118 times
0
-
1you should use SP for font size - not DP – ligi Oct 01 '14 at 11:27
-
1possible duplicate of [How do I convert pt to sp?](http://stackoverflow.com/questions/13404377/how-do-i-convert-pt-to-sp) – grunk Oct 01 '14 at 11:31
-
i think you have to set apperence of text to largfe – Digvesh Patel Oct 01 '14 at 11:38
2 Answers
1
http://angrytools.com/android/pixelcalc/
This site helps you to convert your values px,dp,sp,pt,etc.. make sure you are using the right Density in the drop down.
Your 48dp equals 107sp and 106dp

mujeeb.omr
- 499
- 2
- 12
0
Create dimen.xml for your solution.
Directory will be as follow
1. res -> values-ldpi --> dimen.xml
2. res -> values-mdpi --> dimen.xml
3. res -> values-hdpi --> dimen.xml
4. res -> values-xhdpi --> dimen.xml
5. res -> values-xxhdpi --> dimen.xml
in that file create
<resources>
<dimen name="text_size">size in sp</dimen>
</resources>`
Size will be different for all devices set that according to your layout and requirements.
Now Give Your Textview size with
android:textsize="@dimen/text_size"

Kishan Dhamat
- 3,746
- 2
- 26
- 36
-
2`dp`, `sp`, and `pt` are all density-independent and do not normally need separate definitions per density. – CommonsWare Oct 01 '14 at 11:49
-
If i want to give support to all devices like(320X480 ,480X800 , 800x1280 ,1080X1920). and if i give same font size to textview for ex. 100pt. Then text font's size will varies with devices. Then what to do? – Kishan Dhamat Oct 02 '14 at 07:28
-
"Then text font's size will varies with devices" -- it shouldn't. A point (pt) is 1/72 of an inch, and that does not depend on density. – CommonsWare Oct 02 '14 at 11:19