Remember before the study of a teacher said we often use the size unit for DP and SP, and these two units what difference in today's study and I encountered. In the code described in the book, repeated occurrences are more dp,px. So, I would like to take advantage of this opportunity to figure out the dimensions involved so as to avoid wasting time on this issue later on.
Px:pixels, each pixel corresponds to a point on the screen and is generally used as the unit of focus when setting the resolution.
sp:scaled pixels, a proportional pixel, mainly handles the size of the font, and can be scaled according to the user's font size preference. Crucially, according to Google's recommendation, TextView's font size is best used for the SP font size. So here I'll remember that the unit must be using SP when tapping the character code.
DP: This is a very abstract description, called an abstract unit that describes the density of the screen.
Originally through the book here is not about the DP unit of a processing results, but through the degree Niang, only remember a word good, is to enable the user UI interface in the current and future mobile display type on the normal display, we recommend that you always use the SP as the text size of the Android system units, Use DP as the unit for other elements.
This is a rookie in the learning path of small problems, hope that the great god see the mistakes can help guide, first in advance thank you
Differences between the DP and SP tags in android