Different screen size layout on Android-ThrowExceptions

Exception or error:

I created layouts for each screen. as sw300dp, sw360dp, sw420dp, sw600dp and sw720dp. But there are different screen sizes that support sw-360dp. For example, 1080×1920 and 1080×2280 images change in my changes to sw360. The image is distorted because the two screen sizes are different.

How can I solve this problem?

emulator screen size
layout source

How to solve:

If you want enforce certain size (which in discouraged, because android devices varies in screen ratios, sizes and densities in large extent, and there always be some device, where image will be distorted) you can add constraint for minimum height, like drawable-sw360dp-h1024dp.
Or simply use proper scaleType for imageview.

Leave a Reply

Your email address will not be published. Required fields are marked *