Search code examples
androidtext-size

Convert sp automatically to each other in ldpi, mdpi, hdpi, xhdpi, xxhdpi


I set textSize in my TextView at 14sp in mdpi mode and I dont know what is the best size preference(sp) for textSize in ldpi, hdpi, xhdpi, and xxhdpi modes.

Is there any way to convert sp automatically to each other in ldpi, mdpi, hdpi, xhdpi, xxhdpi modes?


Solution

  • You can use this depedency to handle to all dp and sp : implementation 'com.intuit.sdp:sdp-android:1.0.5' and use in the xml like this:- android:padding="@dimen/_10sdp" also in the java/ kotlin file like this R.dimen._100sdp.