If you are looking to know about the difference between px,dp,sp , here it is:-
px corresponds to actual pixels on the screen.
Pixel is the smallest element of a picture represented on the screen.
dip Density-independent Pixels :-
It is an abstract unit that is based on the physical density of the screen.
dip == dp. In earlier Android versions dip was used and later changed to dp
In 160 dpi screen, 1 dp = 1 pixel.
With the change in screen density there will also be a change in the ratio of dip-to-pixel, but not necessarily in direct proportion.
Except for font size, use dip always.
Note: The compiler accepts both "dip" and "dp".
sp(Scale-independent Pixels) :-
sp is same as the dp unit, but it is also scaled by the user's font size preference. It is recommendable to use this unit while specifying font sizes they will be adjusted for screen density. Fonts should use sp.