android - Using the formula px = dp * (dpi/160) for creating image resources does not result in sharp images -


although question not related programming, related app development.

suppose have imageview dimensions 40dp*40dp. if use above formula create icon device screen density 217 ppi, size of icon fits imageview 55px*55px. if use icon in view in consideration, result icon not appear sharp.

on other hand, if use larger image of size, 80px*80px, appears sharp. larger image larger fitting 1 factor of 1.6.

what know whether there value of above factor efficient , conventional. follow conventions while developing apps.

thanks time.

your imageview size 40dp, thats equal to:

  1. 40 x 1.0 = 40 pixel on mdpi devices
  2. 40 x 1.5 = 60 pixel on hdpi devices
  3. 40 x 2.0 = 80 pixel on xhdpi devices
  4. 40 x 3.0 = 120 pixel on xxhdpi devices
  5. 40 x 4.0 = 160 pixel on xxxhdpi devices

now device hdpi (217). thats device need 60x60 pixel bitmap, , have put in drawable-hdpi directory.

using drawable directory using drawable-mdpi directory. fro each resource in directory android scale up/down before using it.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -