What measurement should we use in android, px, dp, dip or sp?

Which dimension we have to use All Android: px, dp, diporsp

Is there any percentage look in the design of Android layouts, like in CSS for web development.

Which measurement is safe to use in Android to develop interoperability between phones.

+3
source share
3 answers

dipbest used when you need a static size. This is a “device independent pixel” and will be roughly displayed on a physical level on any phone / tablet.

Ideally, you should use layout_weights and smart match_parent and wrap_content implementations to fill most of the fields.

: FYI, dip= dp... . , .

+5
  • dp sp .
  • - layout_weight, .
  • . №1.
+2

dip == dp use dp for all resources as it displays the screen resolution / c. and use sp for font size instead of px since sp works with wrt size and screen resolution

+1
source

All Articles