Skip to main content

Android display Images regardless dpi



I need to run my application on multiple devices with diffrent specs. Now I'm trying to get it work on just two: Samsung Galaxy tab p100 and Galaxy tab 7.0 plus the differnces I'm care about now are dpi,the first device is 240 dpi the second is 170 and the version the first runs 2.2 he later 3.2 first I put the Images on the hdpi folder images on 7.0 plus is smaller and ugly so I copied them to mdpi folder works fine but this would double the size of my APK. Is there any way to make android auto fit Images without the need to copy Images?




Comments

  1. If you want that images look fine in either the device you have to provide the same images for mdpi and hpdi at differente resolution (see Alternative drawables).

    However if you put all you images in mdpi directory only, Android will scale theme for hpdi screens. But you have to use dp and not px for all your dimensions (see Density independence).

    Consider also how Android pre-scale and auto-scale resources (see Additional Density Considerations).

    ReplyDelete
  2. Android 7.0 i guess supports xhdpi images(Xtra Large screens with resolution 960dp x 720dp) So if you would use image of less resolution it would definitely look bad. You can get one high resolution image for xhdpi phone n try do it. I think it will work for you.

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.