Tuesday, 15 March 2011

How to size images to render the same proportion in Android -



How to size images to render the same proportion in Android -

i have design concept need create. designed in given resolution: 480x800. contains box width of 390px has horizontally aligned in middle. there 45 pixels left in both sides.

when create layout in android, have give box width in dp. utilize dp->px calculator , check numbers shows. tells me, have set width 252dp create box 390px wide in hdpi, 480x800 phone. when set it, , starts emulator, shows proportions right.

<edittext android:id="@+id/txtbox" android:layout_width="262dp" android:layout_height="37dp" />

i alter emulator 720x1280, hdpi. width box have? 252 dp (390px)? if so, box take half of screen , proportion off.

how should set image width , size create right proportions? create dynamic?

images in android hard deal with. due resolution factor images in 1 device seems different in proportions other devices. solution utilize appropriate images appropriate screen density. see iconography on developer site. providing alternate resources in folder's drawable-hdpi ensure rendered properly. programming practice utilize wrap_content or match_parent our layout_width or height.

android android-image

No comments:

Post a Comment