Android UI Images vs Layout xml -


i wondering thoughts on better strategy when designing ui android devices.

which preffer:

  1. setting size of elements in xml files, each denisty (and size when needed), using 1 set of images (xxhdpi images) scale down when needed.

    pros - smaller apps (less resources) less work on images ui people.

    cons - more work on xml files (a whole lot sometimes)

  2. create images each denisty (and size if neede) using wrap_content of time.

    pros - 1 set of xml layout files.

    cons - more images , larger sized apk. more work on images ui people.

what other approaches using?

thanks!

i think misunderstanding android doing when scales images not provide. android docs state:

by default, android scales bitmap drawables (.png, .jpg, , .gif files) , nine-patch drawables (.9.png files) render @ appropriate physical size on each device. example, if application provides bitmap drawables baseline, medium screen density (mdpi), system scales them when on high-density screen, , scales them down when on low-density screen. scaling can cause artifacts in bitmaps. ensure bitmaps best, should include alternative versions @ different resolutions different screen densities.

all means if not provide alternate density versions of images, android fill in missing ones (created , correct proportional size) using ones have provided, @ cost of quality of image, since android not going scale image photoshop. if concerned application size, can consider if loss of image quality omitting density versions acceptable tradeoff in order make .apk smaller.

so, #1 , #2 can both use wrap_content, , neither has set size of image manually, unless image needs larger or smaller original size (which in case should create image @ right size). #1 not , should not require more layout work. , #2, saving image @ several sizes not work @ all.

i follow these rules:

  1. create images every density (except ldpi / tvdpi - too few devices, i'm ok image quality loss on them).
  2. use wrap_content , match_parent needed images.
  3. only use dp images downloaded @ runtime, size cannot guaranteed.

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -