In Android, a Drawable is a general abstraction for "something that can be drawn."
Questions tagged [android-drawable]
2993 questions
84
votes
8 answers
Different resolution support android
Edited Question:
Mobile Resolution: I would like to design different screen dpi like following resolutions.
320x480,480×800,540x960,720x1280 (Samsung S3),1080x1920 (S4, Nexus5,Nexus 5x, Moto G4),2560 x 1440 (Nexus 6, Nexus 6p, Samsung edge)
Tablet…

Bhavesh Jethani
- 3,891
- 4
- 24
- 42
73
votes
9 answers
Scale image keeping its aspect ratio in background drawable
How do I make a background image fit the view but keep its aspect ratio when using as a background drawable XML?
None of 's android:gravity values gives the desired effect.

tilex
- 1,744
- 1
- 17
- 32
73
votes
9 answers
Android Studio drawable folders
In Android Studio, I can't figure out where to put images to be used inside the app. The drawable folder isn't broken down into drawable-hdpi, drawable-ldpi, etc. I saw another question asking this and the answer was to switch to Project view…

user3397545
- 787
- 1
- 5
- 8
72
votes
7 answers
Get the ID of a drawable in ImageView
I have one ImageView and set a drawable on it. Now I need to get the ID of the drawable on click event of ImageView dynamically. How can I get it?
imgtopcolor = (ImageView) findViewById(R.id.topcolor);
imgtopcolor.setImageResource(R.drawable.dr); …

chikka.anddev
- 9,569
- 7
- 38
- 46
69
votes
10 answers
Android Studio: Drawable Folder: How to put Images for Multiple dpi?
Hi as per android documentation the drawable folder needs to have multiple sub-directories for images of different dpis. However in Android Studio creating any sub directory in the drawable folder causes it to fail to detect any images at all. On…

praveen
- 815
- 2
- 9
- 12
65
votes
8 answers
How to use RoundedBitmapDrawable
Has anyone managed to use RoundedBitmapDrawable? Correct me if I'm wrong, but to my understanding, it makes a circular image from a regular rectangular image.
What I've tried so far is…

gian1200
- 3,670
- 2
- 30
- 59
62
votes
2 answers
Understanding Android's
I don't understand how the layer-lists work. I read the official documentation with some examples but it does not work for me like expected. I want four squares which should be padded with 1dp, but nothing is like expected. Here is a screenshot…

rekire
- 47,260
- 30
- 167
- 264
57
votes
2 answers
Centering bitmap Marker (Google Maps Android API v2)
When I add a marker from a custom Bitmap, the marker is not centered at the point I specify.
I'm adding it like this:
// ID tramo
final int tramoId = tr.getId();
// Nodos
final Nodo[] nodos = tr.getNodos();
final PolylineOptions…

Charlie-Blake
- 10,832
- 13
- 55
- 90
55
votes
7 answers
Android Vector Drawable not support, not support
In icon.svg
ERROR@ line 9 is not supported
ERROR@ line 10 is not supported
How to export this type of svg to vector drawable? Is this even possible? Or should I look for a new svg?

Arka Prava Basu
- 2,366
- 3
- 18
- 34
55
votes
5 answers
BitmapFactory.decodeResource() returns null for shape defined in xml drawable
I looked through multiple similar questions, although I haven't found a proper answer to my issue.
I have a drawable, defined in shape.xml

mol
- 2,607
- 4
- 21
- 40
55
votes
7 answers
Add gradient to imageview
I want to add a gradient on the bottom of my image . Something like this :
I tried something like this but I only get the gradient no image..

user1163234
- 2,407
- 6
- 35
- 63
51
votes
4 answers
How to set a shape's background in xml?
I just created a red circle using android shapes:

Waza_Be
- 39,407
- 49
- 186
- 260
51
votes
8 answers
Creating & Using 9-patch images in Android
I recently heard about 9-patch images. I know its 9 tiled and is stretchable. I'd like to know more about it.
How can I create a 9-patch image?
Is there any tool? Can I create it from AndroidSDK or code?
Main Advantages of 9-patch over regular…

Nizam
- 5,698
- 9
- 45
- 57
50
votes
9 answers
How to draw a circle inside a circle using Android xml shapes?
I'm trying to make a thumb for a seekbar for my app, and I want to have an inner circle surrounded by a different, larger (semi-transparent) outer circle. I'm trying to use layer-list, but I'm having issues. Below is my code...

jas7457
- 1,971
- 5
- 30
- 47
49
votes
9 answers
Where are the Android icon drawables within the SDK?
In my design of UI of Android applications, I need some drawables for icons.
Where are the existing drawables located within the Android SDK?

user1914692
- 3,033
- 5
- 36
- 61