Hi all, 

(as you read through this)
-- I am not hard coding ANY dimensions or sizes for anything
-- All elements use wrap content and match parent
-- I have read over the Android development for different screen sizes so 
many times I can almost recite the page (not to say I haven't missed 
something, so if I have, please point it out).

I am literally on weeks of trying to figure this out and have read (many 
times) every resource I can find and am still clearly missing something.

I am attempting to get image assets to stay in proportion to the screen on 
different devices.  This seems very fundamental and there is tons of 
documentation, but I am still struggling and would greatly appreciate some 
assistance.

I have created 5 sets of images which look like the following.

ldpi
- dpi of the images is 36 x 36

mdpi 
- dpi of the images is 48 x 48

hdpi
- dpi of the images is 72 x 72

xhdpi
- dpi of the images is 96 x 96

xxhdpi 
- dpi of the images is 144 x 144

I am designing in Android Studio and using one of the 10" xhdpi tablet 
devices to design against.

I have a square image that I am placing 4 times (roughly evenly spaced) at 
the top of my screen and when viewing the screen, the image takes up 
roughly one inch or so. 

To accomplish this, I created an image that is 325x325px with a dpi of 96 
and it looks fantastic.

The problem comes when I try to view my app on smaller device with the same 
density of xhdpi.  In these situations, the image is HUGE and takes up far 
more space than it should.

I believe I understand the difference between pixel (tablet that is 1200 px 
x 800 px) and dip/dp.  Given that the dimensions in pixels are 1200 x 800 
and the density is xhdpi, the dimension in dp would be 600 x 400.

This is where I am getting totally lost.  Clearly I am missing something 
and there must be a way to keep images proportioned correctly when you go 
from a small device size to a larger device size when both use the same 
density (for example, a  800 pixel x 600 px 3" phone and a 2500 pixel x 
1600 pixel 10" tablet which both have a density of xhdpi).

I do also realize that this is only 1/2 of the equation and the use of 
additional layout folders with qualifiers will be needed to potentially 
make adjustments for different screen sizes.  That part I am ok with but I 
am losing my mind over trying to figure out how to get my image assets to 
look the way I need.

Any help would be OH so much appreciated.

One final note.  I have seen several posts where people have stated, "Just 
use xhdpi assets and Android will scale everything for you."  Yes, I know 
this is a performance issue, but even trying that, it certainly is not 
scaling things down for me.  One thing I have noticed is that if I set the 
background property of a layout to an image asset, it seems to display as 
I'd want on every device, regardless of size or density.  However, the 
issue I am having is with image views specifically, so does my problem 
exist there?

Thanks!
Bob

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/d9c3d809-d511-4800-8234-bc2512b4869e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to