How does Jetpack Compose handle drawable resources for different screen densities?

129 views Asked by At

I'm a total newbie with Jetpack Compose. I hope you may help shed some light on my issue.

In the old days, if you had a PNG drawable resource, you would provide multiple versions of that drawable depending on the target screen density - mdpi (1x), hdpi (1.5x), xhdpi (2x), xxhdpi (3x).

My question is regarding the case where you would be missing the drawable for one or more densities. Let's say, you would only provide the mdpi version of a drawable. Using the good old ImageView, running on an xxhdpi device, Android would scale the drawable 3x and render it correctly.

Now, the same does not seem to apply in Jetpack Compose. My specific case is this: I'm providing the mdpi and xhdpi versions of a drawable, but run the Compose app on an xxhdpi device. Compose does not scale the drawable to the xxhdpi size, but renders the xhdpi drawable (which appears smaller).

Is this the correct and expected behavior? What am I missing? Can you point me to some reading material which explains why this happens? Thanks in advance to all of you ;)

0

There are 0 answers