Images for different sizes of android screens

Asked

Viewed 229 times

1

I’m developing an app that uses the camera on android.

About the Framelayout where I display the camera I put a Linearlayout with a background according to the image below:

inserir a descrição da imagem aqui

The problem is this:

I created this image in size 720 x 1280 pixels, IE, with the screen resolution of my phone. It worked perfectly.

When I went to test on another phone with the screen resolution of 480 x 800 pixels, the background was distorted as picture below:

inserir a descrição da imagem aqui

Searching, I found several tutorials talking about the folders drawable-xhdpi, drawable-hdpi, drawable-mdpi, drawable-ldpi, with support for various screen densities. But I didn’t understand how to work with this and also don’t know how to add these folders in my project, because in Android Studio only has the folder drawable pattern.

Please, somebody help me!?

  • 1

    I was going to answer you in detail, but since they marked it as a pendant, there’s no way. To help you install the plugin in android studio called Android Drawable Importer, I use it for being very simple. Here’s a tutorial on how to install and use: https://www.youtube.com/watch?v=bbFLDR6X2D8

  • I got Murillo. Cool, I liked the Plugi, it seems very simple and practical to use even. Doubt, as I created the default image at 720 x 1280 px, when I import this image by the plugin it will create the other resolutions automatically of this image?

  • Yes, you choose which resolutions you want, and the plugin already adapts the image to each resolution and they will be in the drawable folder inside a package with the name of the image and inside this package will be all images with different resolutions.

  • No plugin is required. Android Studio has the Image Asset Studio for that purpose.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.