I am a beginner in Android Development and am trying to understand how to use PNG or vector drawable (XML
) files in my Android App. To practice, I create an App with both images below:
https://imgur.com/RWxaMGt (link to see the res repository)
The purpose was to compare the quality of both structures. The result can be viewed below:
https://i.imgur.com/jMgmsc5.png (link to see the result in the device emulator)
In my device, the image above represents a PNG file while the other (the image below with better quality) represents the vector drawable file.
My question is simple: is there some way to increase the quality of the PNG file in my device activity?
Note: I am using Kotlin and a simple ConstraintLayout
CodePudding user response:
for shwoing high qualitu image you have to choose higher quality image but have to do following for loading that image in all types of devices.
suppose you have a png
image
You have to choose the higher quality image for import like 1920 x 1080.
then You have to use batch drawable importer to import that image into your android studio project
it will create appropriate versions of that high-quality image to show on different devices.
use Glider for loading images it will show images effectively.
here is link for how to use batch drawable importer:
https://akexorcist.dev/android-drawable-importer-plugin/
it will create folders and images of all sizes
xxxhdpi: 1280x1920 px
xxhdpi: 960x1600 px
xhdpi: 640x960 px
hdpi: 480x800 px
mdpi: 320x480 px
ldpi: 240x320 px