I'm new in Android dev and I have a ridiculous question..
I read this Drawable but I didn't understand everything (because I speak french, not english).
Well.. can anyone explain me with simply words what is a Drawable?
Thank you, best regards.
Drwable are something that can be drawn on screen for examples images that are drawn on screen.
See this location res/drawable-hdpi or res/drawable-mdpi or res/drawable-ldpi in your project folder , they all are some types of drawables location where we keep our drawables .
Basically any object that is able to be drawn to the screen
Related
I have a lot of images and I want to classify them in the drawable folder in Android Studio for easy access, is it possible?
Not possible. The only way to sort your drawable resources is by renaming them, usually with prefixes (i.e. ic_ for icons).
You can't put them in folders. However, you can control the name of them to find them easier. For example, if I have buttons coded with shapes, etc, I will name these button_name. This way, it all of my buttons are there for me to view. If I have a few minutes in a certain activity, I will do something like results_, and then all of my results images are there. Hopefully they makes sense and helps.
I have one 9 patch image but i don't know that where i have to put it. only one time in Drawable folder or i have make different folder ( like mdpi,hdpi etc) in drawable for supporting different screen resolution.can anybody suggest me.thanks
Nine Patch images are mainly used to reduce the number of images. So if you are using nine patch, there is no need to use it in different folder we can use it drawable folder alone. This will reduce the number of resources used in the project, which will obviously reduce the apk size too, etc...
Hope this is helpful :)
Both drawable/ and drawable-*dpi/ work.
But I put all drawable *.xml files in drawable/, and all png/webp/jpg files in drawable-*dpi/, which makes the folder cleaner.
As u may use different *.9.png for different screen resolution respectively, drawable-*dpi/ may be a better choice.
Hope it helps.
When i copy-paste an image to the drawable file, i get one image with the original resolution. When i use the New--ImageAset way i get a lot of images for different screen densities but they are all blurry, even xxhdpi! How can i have the different densities inages without this problem?
Im surprise i didnt noticed it before!
I read this but it hasnt helped me
Android ImageView blurry?
http://developer.android.com/guide/practices/screens_support.html
Any advice am i doing it wrong?
EDIT
I tried the AndroidAssetStudio but it still happens
Before
After (xxhdpi)
Cant i get it to be the ldpi and then make it scale up from it or something?
You can create your image in different resolutions using Android Assets Studio. Then, copy paste the image to the respective folder. This will give you a proper image, without blur.
There is a plugin exactly made for the same purpose. You can use that plugin to make different sizes of the same image. You have to copy/paste a single image in drawable folder. Then right click drawable folder and select
NEW>Batch_Drawable_Import. Select the size for your image and it will itself make the other sized images for you.
I am a beginner developer and I am a little confused about drawables and bitmaps. From my current understanding:
-Bitmaps are like empty images (without a type yet?)
-Drawables are images that I can draw on them
What I want to do in the first place is to open a red image I made and then draw on it. How can I do that?
Also, all drawables must be placed in the 3 drawable folders, right?
By the way, what's the different of "assets" and "res" folder?
Thank you in advance.
A drawable might be a bitmap, but maybe a shape
drawable is more general
assets holds file data
res holds (xml) defined data
Just some answers to your bunch of questions
I have a state file for buttons which worked fine until I put drawables into res/drawable-mdpi.
I had only drawable in res/drawable-hdpi but I want the app to work on all displays.
The state file is placed in res/drawable as I read it on some websites.
That way it is also done by google with the standard drawables but Ecplise keeps telling me that it can't find drawable with value #drawable/button_normal.
The drawables are definitely at their places.
So what am I doing wrong here?
Ok...there was nothing wrong with the code, drawables were not ok.
I made them again, 9-patched them and voilĂ : no comments by eclipse.
Sorry for wasting place for this.
make a folder drawable inside res and put ya pics into that folder. and you can refer to them as
android:background="#drawable/oscar"