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:
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:
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!?
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
– Murillo Comino
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?
– RDamazio
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.
– Murillo Comino
Related/duplicate: How to support various types of screens/screens
– ramaral
No plugin is required. Android Studio has the Image Asset Studio for that purpose.
– ramaral