Tutorial by Examples

Android supports several configuration qualifiers that allow you to control how the system selects your alternative resources based on the characteristics of the current device screen. A configuration qualifier is a string that you can append to a resource directory in your Android project and speci...
When you need to set a pixel value for something like Paint.setTextSize but still want it be scaled based on the device, you can convert dp and sp values. DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); float pixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12f, m...
Sometimes, it's better to have only three options style="@android:style/TextAppearance.Small" style="@android:style/TextAppearance.Medium" style="@android:style/TextAppearance.Large" Use small and large to differentiate from normal screen size. <TextView ...

Page 1 of 1