Mengenal ukuran di android pixels, density, dpi, dip, dp, dps, sp, sip


ok mari kita mengenal jauh lebih dekat dengan ukuran android

tipe ukuran yang biasa kita pakai pada android

dp atau dip
Density-independent Pixels – An abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi (dots per inch) screen, on which 1dp is roughly equal to 1px. When running on a higher density screen, the number of pixels used to draw 1dp is scaled up by a factor appropriate for the screen’s dpi. Likewise, when on a lower density screen, the number of pixels used for 1dp is scaled down. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Using dp units (instead of px units) is a simple solution to making the view dimensions in your layout resize properly for different screen densities. In other words, it provides consistency for the real-world sizes of your UI elements across different devices.
sp
Scale-independent Pixels – This is like the dp unit, but it is also scaled by the user’s font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user’s preference.
pt
Points – 1/72 of an inch based on the physical size of the screen.
px
Sesuai dengan piksel yang sebenarnya pada layar. Ini satuan ukuran tidak dianjurkan karena hasilnya dapat bervariasi di seluruh perangkat, setiap perangkat  memiliki pixel layar yang berbeda
mm
Millimeters – ukuran dalam milimeter (10 mm = 1cm)
in
Inches – ukuran dalam inchi (1 inchi = 2.54 cm)

perbedaan pada  ukururan layar sama resolusi beda menghasilkan  (http://blog.edwinevans.me/?p=131)

Lower resolution screen Higher resolution, same size
Physical Width 1.5 inches 1.5 inches
Dots Per Inch (“dpi”) 160 240
Pixels (=width*dpi) 240 360
Density (factor of baseline 160) 1.0 1.5
Density-independent Pixels (“dip” or “dp” or “dps”) 240 240
Scale-independent pixels (“sip” or “sp”) Depends on user font size settings same

TIPS memakai sp/dp  akan membuat aplikasi android anda kompatibel dengan beberapa resolusi, kepadatan ,ukuran layar  yang berbeda

referensi:
http://developer.android.com/guide/topics/resources/more-resources.html#Dimension

semoga berguna

Iklan

tinggalkan pesan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: