Now you can Subscribe using RSS

Submit your Email

Monday

How to stop Android form automatically scaling drawables?

Vishal Shrestha
As you might already know if you put any png of jpeg image files in any of the drawable folder for example, drawable or drawable - xhpdi or any other predefined drawable folder, then android system will automatically resize all those drawables when used in devices with different screen densities. This can be a pretty neat and you will usually want this, but if for some reason you don't want android to resize image according to screen size then you can simply create a new folder called drawable-nodpi and put all your image files in this folder and you are done. Android system won't resize your images according to screen size anymore.
Drawable folders

You can see here drawable-nodpi folder. All the image that you don't want to be scaled go in here.
Drawable folders can be really useful. As you can see above, you can create different folders for different orientations combined with different screen sizes too.
NOTE- If you put your image in the drawable folder then it will be treated as if in drawable-mdpi folder.

Vishal Shrestha / Author & Founder

A developer by profession, a born Adventurer. I mainly do Android but like to get my hands dirty with web development and a little bit of Python. I would't rather go on a Trek than a party and you can find me having a few rounds with the heavy bag to let out the steam ;)

For Business info : My Portfolio Site.

0 comments:

Post a Comment

Coprights @ 2017 | The Code City by Vishal Shrestha Vishal Shrestha