سؤال

I'm new to Android and I'd like to know why those images I put in hdpi, ldpi, mdpi, xhdpifolders are not actually responding to what I want.

In hdpi, I put images that are fit for big screens.

In ldpi, for small screens, in mdpi for normal screens and for xhdpi for tablets.

But I wonder why it's still not displaying the correct images for big screens. It looks like small images (that are fit for small screens) on the screen. I have named the images exactly the same. What is wrong with this?

I need your suggestion. Help is much appreciated. Thanks in advance.

هل كانت مفيدة؟

المحلول

I think that you don't have the problem in the code, nor in the images, but in the devices you're using to try the different densities. If you are assuming that larger screens means higher densities, that is not always the case. Note that hdpi, ldpi, mdpi and xhdpi refer to density, not screen size.

For example, below you can find two screenshots of the same ImageView pointing to the same @drawable/a icon but deployed in two devices with different screen density. To make the point I have placed completely different icons (both with the same name a.png) in each density folder so that the difference can be easily appreciated:

2.7" - ldpi2.7" - ldpi 3.7" - hdpi3.7" - hdpi

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top